OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/version.h" | 8 #include "base/version.h" |
9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include "chrome/common/chrome_version_info.h" | 32 #include "chrome/common/chrome_version_info.h" |
33 #include "chrome/common/extensions/features/feature_channel.h" | 33 #include "chrome/common/extensions/features/feature_channel.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "extensions/browser/api/generated_api_registration.h" | 35 #include "extensions/browser/api/generated_api_registration.h" |
36 #include "extensions/browser/extension_function_registry.h" | 36 #include "extensions/browser/extension_function_registry.h" |
37 #include "extensions/browser/extension_prefs.h" | 37 #include "extensions/browser/extension_prefs.h" |
38 #include "extensions/browser/pref_names.h" | 38 #include "extensions/browser/pref_names.h" |
39 #include "extensions/browser/url_request_util.h" | 39 #include "extensions/browser/url_request_util.h" |
40 | 40 |
41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
42 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
42 #include "chrome/browser/extensions/updater/extension_cache_impl.h" | 43 #include "chrome/browser/extensions/updater/extension_cache_impl.h" |
43 #include "chromeos/chromeos_switches.h" | 44 #include "chromeos/chromeos_switches.h" |
44 #else | 45 #else |
45 #include "extensions/browser/updater/null_extension_cache.h" | 46 #include "extensions/browser/updater/null_extension_cache.h" |
46 #endif | 47 #endif |
47 | 48 |
48 namespace extensions { | 49 namespace extensions { |
49 | 50 |
50 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { | 51 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { |
51 process_manager_delegate_.reset(new ChromeProcessManagerDelegate); | 52 process_manager_delegate_.reset(new ChromeProcessManagerDelegate); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 content::BrowserContext* ChromeExtensionsBrowserClient::GetOffTheRecordContext( | 93 content::BrowserContext* ChromeExtensionsBrowserClient::GetOffTheRecordContext( |
93 content::BrowserContext* context) { | 94 content::BrowserContext* context) { |
94 return static_cast<Profile*>(context)->GetOffTheRecordProfile(); | 95 return static_cast<Profile*>(context)->GetOffTheRecordProfile(); |
95 } | 96 } |
96 | 97 |
97 content::BrowserContext* ChromeExtensionsBrowserClient::GetOriginalContext( | 98 content::BrowserContext* ChromeExtensionsBrowserClient::GetOriginalContext( |
98 content::BrowserContext* context) { | 99 content::BrowserContext* context) { |
99 return static_cast<Profile*>(context)->GetOriginalProfile(); | 100 return static_cast<Profile*>(context)->GetOriginalProfile(); |
100 } | 101 } |
101 | 102 |
103 std::string ChromeExtensionsBrowserClient::GetUserIdHashFromContext( | |
104 content::BrowserContext* context) { | |
105 #if defined(OS_CHROMEOS) | |
106 return chromeos::ProfileHelper::GetUserIdHashFromProfile( | |
107 static_cast<Profile*>(context)); | |
108 #else | |
109 return context->GetPath().BaseName().value(); | |
Daniel Erat
2015/01/23 23:24:29
is this approach already used for non-chrome-os el
stevenjb
2015/01/23 23:57:57
Currently "GetUserIdHash" is a chromeos specific c
Daniel Erat
2015/01/24 02:14:03
i don't have strong opinions about this / don't kn
| |
110 #endif | |
111 } | |
112 | |
102 bool ChromeExtensionsBrowserClient::IsGuestSession( | 113 bool ChromeExtensionsBrowserClient::IsGuestSession( |
103 content::BrowserContext* context) const { | 114 content::BrowserContext* context) const { |
104 return static_cast<Profile*>(context)->IsGuestSession(); | 115 return static_cast<Profile*>(context)->IsGuestSession(); |
105 } | 116 } |
106 | 117 |
107 bool ChromeExtensionsBrowserClient::IsExtensionIncognitoEnabled( | 118 bool ChromeExtensionsBrowserClient::IsExtensionIncognitoEnabled( |
108 const std::string& extension_id, | 119 const std::string& extension_id, |
109 content::BrowserContext* context) const { | 120 content::BrowserContext* context) const { |
110 return IsGuestSession(context) | 121 return IsGuestSession(context) |
111 || util::IsIncognitoEnabled(extension_id, context); | 122 || util::IsIncognitoEnabled(extension_id, context); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 base::Version browser_version = base::Version(version_info.Version()); | 302 base::Version browser_version = base::Version(version_info.Version()); |
292 Version browser_min_version(min_version); | 303 Version browser_min_version(min_version); |
293 if (browser_version.IsValid() && browser_min_version.IsValid() && | 304 if (browser_version.IsValid() && browser_min_version.IsValid() && |
294 browser_min_version.CompareTo(browser_version) > 0) { | 305 browser_min_version.CompareTo(browser_version) > 0) { |
295 return false; | 306 return false; |
296 } | 307 } |
297 return true; | 308 return true; |
298 } | 309 } |
299 | 310 |
300 } // namespace extensions | 311 } // namespace extensions |
OLD | NEW |