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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/ui/app_list/app_list_service.h" | 9 #include "chrome/browser/ui/app_list/app_list_service.h" |
10 | 10 |
11 #if defined(TOOLKIT_VIEWS) | 11 #if defined(TOOLKIT_VIEWS) |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/profiles/profile_attributes_entry.h" | 14 #include "chrome/browser/profiles/profile_attributes_entry.h" |
15 #include "chrome/browser/profiles/profile_attributes_storage.h" | 15 #include "chrome/browser/profiles/profile_attributes_storage.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_navigator.h" | 19 #include "chrome/browser/ui/browser_navigator.h" |
20 #include "chrome/browser/ui/browser_navigator_params.h" | 20 #include "chrome/browser/ui/browser_navigator_params.h" |
21 #include "chrome/browser/ui/user_manager.h" | 21 #include "chrome/browser/ui/user_manager.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "components/signin/core/common/profile_management_switches.h" | |
25 #include "ui/base/page_transition_types.h" | 24 #include "ui/base/page_transition_types.h" |
26 #endif | 25 #endif |
27 | 26 |
28 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
29 #include "chrome/browser/ui/app_list/app_list_service_disabled_mac.h" | 28 #include "chrome/browser/ui/app_list/app_list_service_disabled_mac.h" |
30 #endif | 29 #endif |
31 | 30 |
32 namespace { | 31 namespace { |
33 | 32 |
34 class AppListServiceDisabled : public AppListService { | 33 class AppListServiceDisabled : public AppListService { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 AppListControllerDelegate* GetControllerDelegate() override { | 73 AppListControllerDelegate* GetControllerDelegate() override { |
75 return nullptr; | 74 return nullptr; |
76 } | 75 } |
77 void CreateShortcut() override {} | 76 void CreateShortcut() override {} |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled); | 78 DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled); |
80 }; | 79 }; |
81 | 80 |
82 #if defined(TOOLKIT_VIEWS) | 81 #if defined(TOOLKIT_VIEWS) |
83 bool IsProfileSignedOut(Profile* profile) { | 82 bool IsProfileSignedOut(Profile* profile) { |
84 // The signed out status only makes sense at the moment in the context of the | |
85 // --new-profile-management flag. | |
86 if (!switches::IsNewProfileManagement()) | |
87 return false; | |
88 ProfileAttributesEntry* entry; | 83 ProfileAttributesEntry* entry; |
89 bool has_entry = | 84 bool has_entry = |
90 g_browser_process->profile_manager() | 85 g_browser_process->profile_manager() |
91 ->GetProfileAttributesStorage() | 86 ->GetProfileAttributesStorage() |
92 .GetProfileAttributesWithPath(profile->GetPath(), &entry); | 87 .GetProfileAttributesWithPath(profile->GetPath(), &entry); |
93 return has_entry && entry->IsSigninRequired(); | 88 return has_entry && entry->IsSigninRequired(); |
94 } | 89 } |
95 | 90 |
96 // Opens a Chrome browser tab at chrome://apps. | 91 // Opens a Chrome browser tab at chrome://apps. |
97 void OpenAppsPage(Profile* fallback_profile) { | 92 void OpenAppsPage(Profile* fallback_profile) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 #if defined(TOOLKIT_VIEWS) | 134 #if defined(TOOLKIT_VIEWS) |
140 if (!command_line.HasSwitch(switches::kShowAppList)) | 135 if (!command_line.HasSwitch(switches::kShowAppList)) |
141 return false; | 136 return false; |
142 | 137 |
143 OpenAppsPage(launch_profile); | 138 OpenAppsPage(launch_profile); |
144 return true; | 139 return true; |
145 #else | 140 #else |
146 return false; | 141 return false; |
147 #endif | 142 #endif |
148 } | 143 } |
OLD | NEW |