OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "chrome/common/json_pref_store.h" | 46 #include "chrome/common/json_pref_store.h" |
47 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
48 #include "chrome/common/render_messages.h" | 48 #include "chrome/common/render_messages.h" |
49 #include "content/browser/appcache/chrome_appcache_service.h" | 49 #include "content/browser/appcache/chrome_appcache_service.h" |
50 #include "content/browser/browser_thread.h" | 50 #include "content/browser/browser_thread.h" |
51 #include "content/browser/chrome_blob_storage_context.h" | 51 #include "content/browser/chrome_blob_storage_context.h" |
52 #include "content/browser/file_system/browser_file_system_helper.h" | 52 #include "content/browser/file_system/browser_file_system_helper.h" |
53 #include "content/browser/host_zoom_map.h" | 53 #include "content/browser/host_zoom_map.h" |
54 #include "content/browser/in_process_webkit/webkit_context.h" | 54 #include "content/browser/in_process_webkit/webkit_context.h" |
55 #include "content/browser/ssl/ssl_host_state.h" | 55 #include "content/browser/ssl/ssl_host_state.h" |
| 56 #include "content/browser/tab_contents/tab_contents.h" |
| 57 #include "content/browser/webui/web_ui.h" |
56 #include "content/common/notification_service.h" | 58 #include "content/common/notification_service.h" |
57 #include "grit/locale_settings.h" | 59 #include "grit/locale_settings.h" |
58 #include "net/base/transport_security_state.h" | 60 #include "net/base/transport_security_state.h" |
59 #include "ui/base/resource/resource_bundle.h" | 61 #include "ui/base/resource/resource_bundle.h" |
60 #include "webkit/database/database_tracker.h" | 62 #include "webkit/database/database_tracker.h" |
61 #include "webkit/quota/quota_manager.h" | 63 #include "webkit/quota/quota_manager.h" |
62 | 64 |
63 #if defined(TOOLKIT_USES_GTK) | 65 #if defined(TOOLKIT_USES_GTK) |
64 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 66 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
65 #endif | 67 #endif |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 g_first_profile_launched = false; | 103 g_first_profile_launched = false; |
102 } | 104 } |
103 | 105 |
104 // static | 106 // static |
105 Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { | 107 Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { |
106 // This is safe; this is the only implementation of the browser context. | 108 // This is safe; this is the only implementation of the browser context. |
107 return static_cast<Profile*>(browser_context); | 109 return static_cast<Profile*>(browser_context); |
108 } | 110 } |
109 | 111 |
110 // static | 112 // static |
| 113 Profile* Profile::FromWebUI(WebUI* web_ui) { |
| 114 return FromBrowserContext(web_ui->tab_contents()->browser_context()); |
| 115 } |
| 116 |
| 117 // static |
111 const char* const Profile::kProfileKey = "__PROFILE__"; | 118 const char* const Profile::kProfileKey = "__PROFILE__"; |
112 | 119 |
113 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 120 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
114 // static | 121 // static |
115 const LocalProfileId Profile::kInvalidLocalProfileId = | 122 const LocalProfileId Profile::kInvalidLocalProfileId = |
116 static_cast<LocalProfileId>(0); | 123 static_cast<LocalProfileId>(0); |
117 #endif | 124 #endif |
118 | 125 |
119 // static | 126 // static |
120 void Profile::RegisterUserPrefs(PrefService* prefs) { | 127 void Profile::RegisterUserPrefs(PrefService* prefs) { |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 }; | 874 }; |
868 #endif | 875 #endif |
869 | 876 |
870 Profile* Profile::CreateOffTheRecordProfile() { | 877 Profile* Profile::CreateOffTheRecordProfile() { |
871 #if defined(OS_CHROMEOS) | 878 #if defined(OS_CHROMEOS) |
872 if (Profile::IsGuestSession()) | 879 if (Profile::IsGuestSession()) |
873 return new GuestSessionProfile(this); | 880 return new GuestSessionProfile(this); |
874 #endif | 881 #endif |
875 return new OffTheRecordProfileImpl(this); | 882 return new OffTheRecordProfileImpl(this); |
876 } | 883 } |
OLD | NEW |