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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
45 #include "components/net_log/chrome_net_log.h" | 45 #include "components/net_log/chrome_net_log.h" |
46 #include "components/update_client/update_client.h" | 46 #include "components/update_client/update_client.h" |
47 #include "components/version_info/version_info.h" | 47 #include "components/version_info/version_info.h" |
48 #include "content/public/browser/render_process_host.h" | 48 #include "content/public/browser/render_process_host.h" |
49 #include "content/public/common/content_switches.h" | 49 #include "content/public/common/content_switches.h" |
50 #include "extensions/browser/api/generated_api_registration.h" | 50 #include "extensions/browser/api/generated_api_registration.h" |
51 #include "extensions/browser/extension_function_registry.h" | 51 #include "extensions/browser/extension_function_registry.h" |
52 #include "extensions/browser/extension_prefs.h" | 52 #include "extensions/browser/extension_prefs.h" |
53 #include "extensions/browser/extension_util.h" | |
53 #include "extensions/browser/mojo/service_registration.h" | 54 #include "extensions/browser/mojo/service_registration.h" |
54 #include "extensions/browser/pref_names.h" | 55 #include "extensions/browser/pref_names.h" |
55 #include "extensions/browser/url_request_util.h" | 56 #include "extensions/browser/url_request_util.h" |
56 #include "extensions/common/features/feature_channel.h" | 57 #include "extensions/common/features/feature_channel.h" |
58 #include "extensions/common/features/feature_session_type.h" | |
57 | 59 |
58 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
59 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 61 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
60 #include "chrome/browser/extensions/updater/chromeos_extension_cache_delegate.h" | 62 #include "chrome/browser/extensions/updater/chromeos_extension_cache_delegate.h" |
61 #include "chrome/browser/extensions/updater/extension_cache_impl.h" | 63 #include "chrome/browser/extensions/updater/extension_cache_impl.h" |
62 #include "chromeos/chromeos_switches.h" | 64 #include "chromeos/chromeos_switches.h" |
63 #include "components/user_manager/user_manager.h" | 65 #include "components/user_manager/user_manager.h" |
64 #else | 66 #else |
65 #include "extensions/browser/updater/null_extension_cache.h" | 67 #include "extensions/browser/updater/null_extension_cache.h" |
66 #endif | 68 #endif |
67 | 69 |
68 namespace extensions { | 70 namespace extensions { |
69 | 71 |
72 namespace { | |
73 | |
74 FeatureSessionType GetCurrentSessionType() { | |
75 #if defined(OS_CHROMEOS) | |
76 if (!user_manager::UserManager::IsInitialized()) | |
77 return FEATURE_SESSION_TYPE_UNKNOWN; | |
78 if (user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount()) | |
79 return FEATURE_SESSION_TYPE_REGULAR; | |
80 if (user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) | |
81 return FEATURE_SESSION_TYPE_KIOSK; | |
82 return FEATURE_SESSION_TYPE_UNKNOWN; | |
83 #else | |
84 return FEATURE_SESSION_TYPE_REGULAR; | |
Devlin
2016/08/18 17:19:15
indentation
tbarzic
2016/08/18 18:58:10
Done, but I realized I have to move this a bit lat
| |
85 #endif | |
86 } | |
87 | |
88 } // namespace | |
89 | |
70 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { | 90 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { |
71 process_manager_delegate_.reset(new ChromeProcessManagerDelegate); | 91 process_manager_delegate_.reset(new ChromeProcessManagerDelegate); |
72 api_client_.reset(new ChromeExtensionsAPIClient); | 92 api_client_.reset(new ChromeExtensionsAPIClient); |
73 // Only set if it hasn't already been set (e.g. by a test). | 93 // Only set if it hasn't already been set (e.g. by a test). |
74 if (GetCurrentChannel() == GetDefaultChannel()) | 94 if (GetCurrentChannel() == GetDefaultChannel()) |
75 SetCurrentChannel(chrome::GetChannel()); | 95 SetCurrentChannel(chrome::GetChannel()); |
96 SetCurrentFeatureSessionType(GetCurrentSessionType()); | |
76 resource_manager_.reset(new ChromeComponentExtensionResourceManager()); | 97 resource_manager_.reset(new ChromeComponentExtensionResourceManager()); |
77 } | 98 } |
78 | 99 |
79 ChromeExtensionsBrowserClient::~ChromeExtensionsBrowserClient() {} | 100 ChromeExtensionsBrowserClient::~ChromeExtensionsBrowserClient() {} |
80 | 101 |
81 bool ChromeExtensionsBrowserClient::IsShuttingDown() { | 102 bool ChromeExtensionsBrowserClient::IsShuttingDown() { |
82 return g_browser_process->IsShuttingDown(); | 103 return g_browser_process->IsShuttingDown(); |
83 } | 104 } |
84 | 105 |
85 bool ChromeExtensionsBrowserClient::AreExtensionsDisabled( | 106 bool ChromeExtensionsBrowserClient::AreExtensionsDisabled( |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 new ChromeExtensionBluetoothChooser(frame, event_handler)); | 432 new ChromeExtensionBluetoothChooser(frame, event_handler)); |
412 } | 433 } |
413 | 434 |
414 bool ChromeExtensionsBrowserClient::IsActivityLoggingEnabled( | 435 bool ChromeExtensionsBrowserClient::IsActivityLoggingEnabled( |
415 content::BrowserContext* context) { | 436 content::BrowserContext* context) { |
416 ActivityLog* activity_log = ActivityLog::GetInstance(context); | 437 ActivityLog* activity_log = ActivityLog::GetInstance(context); |
417 return activity_log && activity_log->is_active(); | 438 return activity_log && activity_log->is_active(); |
418 } | 439 } |
419 | 440 |
420 } // namespace extensions | 441 } // namespace extensions |
OLD | NEW |