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

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_disabled.cc

Issue 1973203002: Make --show-app-list go to the chrome://apps page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove dep patchset Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/app_list/app_list_service.h" 8 #include "chrome/browser/ui/app_list/app_list_service.h"
9 9
10 #if defined(TOOLKIT_VIEWS)
11 #include "base/command_line.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/profiles/profile_attributes_entry.h"
14 #include "chrome/browser/profiles/profile_attributes_storage.h"
15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/browser_navigator.h"
19 #include "chrome/browser/ui/browser_navigator_params.h"
20 #include "chrome/browser/ui/user_manager.h"
21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/url_constants.h"
23 #include "components/signin/core/common/profile_management_switches.h"
24 #include "ui/base/page_transition_types.h"
25 #endif
26
10 namespace { 27 namespace {
11 28
12 class AppListServiceDisabled : public AppListService { 29 class AppListServiceDisabled : public AppListService {
13 public: 30 public:
14 static AppListServiceDisabled* GetInstance() { 31 static AppListServiceDisabled* GetInstance() {
15 return base::Singleton< 32 return base::Singleton<
16 AppListServiceDisabled, 33 AppListServiceDisabled,
17 base::LeakySingletonTraits<AppListServiceDisabled>>::get(); 34 base::LeakySingletonTraits<AppListServiceDisabled>>::get();
18 } 35 }
19 36
(...skipping 30 matching lines...) Expand all
50 AppListEnableSource enable_source) override {} 67 AppListEnableSource enable_source) override {}
51 gfx::NativeWindow GetAppListWindow() override { return nullptr; } 68 gfx::NativeWindow GetAppListWindow() override { return nullptr; }
52 AppListControllerDelegate* GetControllerDelegate() override { 69 AppListControllerDelegate* GetControllerDelegate() override {
53 return nullptr; 70 return nullptr;
54 } 71 }
55 void CreateShortcut() override {} 72 void CreateShortcut() override {}
56 73
57 DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled); 74 DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled);
58 }; 75 };
59 76
77 #if defined(TOOLKIT_VIEWS)
78 bool IsProfileSignedOut(Profile* profile) {
79 // The signed out status only makes sense at the moment in the context of the
80 // --new-profile-management flag.
81 if (!switches::IsNewProfileManagement())
82 return false;
83 ProfileAttributesEntry* entry;
84 bool has_entry =
85 g_browser_process->profile_manager()
86 ->GetProfileAttributesStorage()
87 .GetProfileAttributesWithPath(profile->GetPath(), &entry);
88 return has_entry && entry->IsSigninRequired();
89 }
90 #endif
91
60 } // namespace 92 } // namespace
61 93
62 // static 94 // static
63 AppListService* AppListService::Get() { 95 AppListService* AppListService::Get() {
64 return AppListServiceDisabled::GetInstance(); 96 return AppListServiceDisabled::GetInstance();
65 } 97 }
66 98
67 // static 99 // static
68 void AppListService::InitAll(Profile* initial_profile, 100 void AppListService::InitAll(Profile* initial_profile,
69 const base::FilePath& profile_path) {} 101 const base::FilePath& profile_path) {}
70 102
71 // static 103 // static
72 void AppListService::RegisterPrefs(PrefRegistrySimple* registry) {} 104 void AppListService::RegisterPrefs(PrefRegistrySimple* registry) {}
73 105
74 // static 106 // static
75 bool AppListService::HandleLaunchCommandLine( 107 bool AppListService::HandleLaunchCommandLine(
76 const base::CommandLine& command_line, 108 const base::CommandLine& command_line,
77 Profile* launch_profile) { 109 Profile* launch_profile) {
110 #if defined(TOOLKIT_VIEWS)
111 if (!command_line.HasSwitch(switches::kShowAppList))
112 return false;
113
114 Browser* browser = chrome::FindLastActive();
115 Profile* app_list_profile = browser ? browser->profile() : launch_profile;
116
117 if (IsProfileSignedOut(app_list_profile) ||
118 app_list_profile->IsSystemProfile()) {
119 UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL,
120 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
121 return true;
122 }
123
124 chrome::NavigateParams params(app_list_profile,
125 GURL(chrome::kChromeUIAppsURL),
126 ui::PAGE_TRANSITION_AUTO_BOOKMARK);
127 chrome::Navigate(&params);
128 return true;
129 #else
78 return false; 130 return false;
131 #endif
79 } 132 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698