Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / profiles / profile_io_data.cc
index 4aa1903..ba8b91e 100644 (file)
@@ -30,7 +30,6 @@
 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
 #include "chrome/browser/download/download_service.h"
 #include "chrome/browser/download/download_service_factory.h"
-#include "chrome/browser/extensions/extension_protocols.h"
 #include "chrome/browser/extensions/extension_resource_protocols.h"
 #include "chrome/browser/io_thread.h"
 #include "chrome/browser/media/media_device_id_salt.h"
@@ -55,6 +54,7 @@
 #include "content/public/browser/host_zoom_map.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/resource_context.h"
+#include "extensions/browser/extension_protocols.h"
 #include "extensions/browser/extension_system.h"
 #include "extensions/browser/info_map.h"
 #include "extensions/common/constants.h"
@@ -154,9 +154,8 @@ bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) {
 
   std::string relative_path;
   const std::string& spec = stripped_url.possibly_invalid_spec();
-  const url_parse::Parsed& parsed =
-      stripped_url.parsed_for_possibly_invalid_spec();
-  int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false);
+  const url::Parsed& parsed = stripped_url.parsed_for_possibly_invalid_spec();
+  int offset = parsed.CountCharactersBefore(url::Parsed::PATH, false);
   if (offset < static_cast<int>(spec.size()))
     relative_path.assign(spec.substr(offset + bundled_path_prefix.length()));
 
@@ -461,6 +460,10 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
   }
 #endif
 
+  incognito_availibility_pref_.Init(
+      prefs::kIncognitoModeAvailability, pref_service);
+  incognito_availibility_pref_.MoveToThread(io_message_loop_proxy);
+
   initialized_on_UI_thread_ = true;
 
   // We need to make sure that content initializes its own data structures that
@@ -1038,10 +1041,12 @@ scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults(
   DCHECK(set_protocol);
 
   DCHECK(extension_info_map_.get());
+  // Check only for incognito (and not Chrome OS guest mode GUEST_PROFILE).
+  bool is_incognito = profile_type() == Profile::INCOGNITO_PROFILE;
   set_protocol = job_factory->SetProtocolHandler(
       extensions::kExtensionScheme,
-      CreateExtensionProtocolHandler(profile_type(),
-                                     extension_info_map_.get()));
+      extensions::CreateExtensionProtocolHandler(is_incognito,
+                                                 extension_info_map_.get()));
   DCHECK(set_protocol);
   set_protocol = job_factory->SetProtocolHandler(
       extensions::kExtensionResourceScheme,
@@ -1124,6 +1129,7 @@ void ProfileIOData::ShutdownOnUIThread() {
 #endif
   if (chrome_http_user_agent_settings_)
     chrome_http_user_agent_settings_->CleanupOnUIThread();
+  incognito_availibility_pref_.Destroy();
   bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
   if (!posted)
     delete this;