Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/extensions/chrome_process_manager_delegate.cc

Issue 2927303003: Add hooks to allow lock screen app pages in sign-in profile (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_process_manager_delegate.h" 5 #include "chrome/browser/extensions/chrome_process_manager_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/extensions/extension_management.h" 12 #include "chrome/browser/extensions/extension_management.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "components/user_manager/user_manager.h" 18 #include "components/user_manager/user_manager.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
21 #include "extensions/browser/process_manager.h" 21 #include "extensions/browser/process_manager.h"
22 #include "extensions/browser/process_manager_factory.h" 22 #include "extensions/browser/process_manager_factory.h"
23 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
24 #include "extensions/common/one_shot_event.h" 24 #include "extensions/common/one_shot_event.h"
25 #include "extensions/common/permissions/api_permission.h"
26 #include "extensions/common/permissions/permissions_data.h"
25 27
26 #if defined(OS_CHROMEOS) 28 #if defined(OS_CHROMEOS)
27 #include "chrome/browser/chromeos/profiles/profile_helper.h" 29 #include "chrome/browser/chromeos/profiles/profile_helper.h"
30 #include "chromeos/chromeos_switches.h"
28 #endif 31 #endif
29 32
30 namespace extensions { 33 namespace extensions {
31 34
32 ChromeProcessManagerDelegate::ChromeProcessManagerDelegate() { 35 ChromeProcessManagerDelegate::ChromeProcessManagerDelegate() {
33 registrar_.Add(this, 36 registrar_.Add(this,
34 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 37 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
35 content::NotificationService::AllSources()); 38 content::NotificationService::AllSources());
36 registrar_.Add(this, 39 registrar_.Add(this,
37 chrome::NOTIFICATION_PROFILE_CREATED, 40 chrome::NOTIFICATION_PROFILE_CREATED,
(...skipping 24 matching lines...) Expand all
62 content::BrowserContext* context, 65 content::BrowserContext* context,
63 const Extension& extension) const { 66 const Extension& extension) const {
64 #if defined(OS_CHROMEOS) 67 #if defined(OS_CHROMEOS)
65 Profile* profile = Profile::FromBrowserContext(context); 68 Profile* profile = Profile::FromBrowserContext(context);
66 69
67 const bool is_signin_profile = 70 const bool is_signin_profile =
68 chromeos::ProfileHelper::IsSigninProfile(profile) && 71 chromeos::ProfileHelper::IsSigninProfile(profile) &&
69 !profile->IsOffTheRecord(); 72 !profile->IsOffTheRecord();
70 73
71 if (is_signin_profile) { 74 if (is_signin_profile) {
75 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
76 chromeos::switches::kEnableLockScreenApps) &&
77 extension.permissions_data()->HasAPIPermission(
78 APIPermission::kLockScreen)) {
79 return true;
80 }
81
72 // Check for flag. 82 // Check for flag.
73 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 83 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
74 switches::kDisableLoginScreenApps)) { 84 switches::kDisableLoginScreenApps)) {
75 return false; 85 return false;
76 } 86 }
77 87
78 // Get login screen apps installed by policy. 88 // Get login screen apps installed by policy.
79 std::unique_ptr<base::DictionaryValue> login_screen_apps_list = 89 std::unique_ptr<base::DictionaryValue> login_screen_apps_list =
80 ExtensionManagementFactory::GetForBrowserContext(context) 90 ExtensionManagementFactory::GetForBrowserContext(context)
81 ->GetForceInstallList(); 91 ->GetForceInstallList();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 ProcessManager* incognito_manager = 207 ProcessManager* incognito_manager =
198 ProcessManagerFactory::GetForBrowserContextIfExists( 208 ProcessManagerFactory::GetForBrowserContextIfExists(
199 profile->GetOffTheRecordProfile()); 209 profile->GetOffTheRecordProfile());
200 if (incognito_manager) { 210 if (incognito_manager) {
201 incognito_manager->CloseBackgroundHosts(); 211 incognito_manager->CloseBackgroundHosts();
202 } 212 }
203 } 213 }
204 } 214 }
205 215
206 } // namespace extensions 216 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/lock_screen_apps/note_taking_browsertest.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698