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

Side by Side Diff: chrome/browser/ui/extensions/extension_install_ui_default.cc

Issue 12207104: Refactor app_list_util.h into AppListService abstract base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for r184604=r184636 Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/extensions/extension_install_ui_default.h" 5 #include "chrome/browser/ui/extensions/extension_install_ui_default.h"
6 6
7 #include "apps/app_launcher.h" 7 #include "apps/app_launcher.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
12 #include "chrome/browser/api/infobars/infobar_service.h" 12 #include "chrome/browser/api/infobars/infobar_service.h"
13 #include "chrome/browser/extensions/extension_install_prompt.h" 13 #include "chrome/browser/extensions/extension_install_prompt.h"
14 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 14 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/themes/theme_service.h" 16 #include "chrome/browser/themes/theme_service.h"
17 #include "chrome/browser/themes/theme_service_factory.h" 17 #include "chrome/browser/themes/theme_service_factory.h"
18 #include "chrome/browser/ui/app_list/app_list_util.h" 18 #include "chrome/browser/ui/app_list/app_list_service.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_dialogs.h" 20 #include "chrome/browser/ui/browser_dialogs.h"
21 #include "chrome/browser/ui/browser_finder.h" 21 #include "chrome/browser/ui/browser_finder.h"
22 #include "chrome/browser/ui/browser_navigator.h" 22 #include "chrome/browser/ui/browser_navigator.h"
23 #include "chrome/browser/ui/browser_tabstrip.h" 23 #include "chrome/browser/ui/browser_tabstrip.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/host_desktop.h" 25 #include "chrome/browser/ui/host_desktop.h"
26 #include "chrome/browser/ui/simple_message_box.h" 26 #include "chrome/browser/ui/simple_message_box.h"
27 #include "chrome/browser/ui/singleton_tabs.h" 27 #include "chrome/browser/ui/singleton_tabs.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const extensions::CrxInstallerError& error) { 101 const extensions::CrxInstallerError& error) {
102 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 102 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
103 new ErrorInfobarDelegate(infobar_service, browser, error))); 103 new ErrorInfobarDelegate(infobar_service, browser, error)));
104 } 104 }
105 105
106 void OnAppLauncherEnabledCompleted(const extensions::Extension* extension, 106 void OnAppLauncherEnabledCompleted(const extensions::Extension* extension,
107 Browser* browser, 107 Browser* browser,
108 SkBitmap* icon, 108 SkBitmap* icon,
109 bool use_bubble, 109 bool use_bubble,
110 bool use_launcher) { 110 bool use_launcher) {
111 #if defined(ENABLE_APP_LIST)
112 if (use_launcher) { 111 if (use_launcher) {
113 chrome::ShowAppList(browser->profile()); 112 AppListService::Get()->ShowAppList(browser->profile());
114 113
115 content::NotificationService::current()->Notify( 114 content::NotificationService::current()->Notify(
116 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, 115 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST,
117 content::Source<Profile>(browser->profile()), 116 content::Source<Profile>(browser->profile()),
118 content::Details<const std::string>(&extension->id())); 117 content::Details<const std::string>(&extension->id()));
119 return; 118 return;
120 } 119 }
121 #endif
122 120
123 if (use_bubble) { 121 if (use_bubble) {
124 chrome::ShowExtensionInstalledBubble(extension, browser, *icon); 122 chrome::ShowExtensionInstalledBubble(extension, browser, *icon);
125 return; 123 return;
126 } 124 }
127 125
128 ExtensionInstallUI::OpenAppInstalledUI(browser, extension->id()); 126 ExtensionInstallUI::OpenAppInstalledUI(browser, extension->id());
129 } 127 }
130 128
131 } // namespace 129 } // namespace
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 219
222 // static 220 // static
223 ExtensionInstallUI* ExtensionInstallUI::Create(Profile* profile) { 221 ExtensionInstallUI* ExtensionInstallUI::Create(Profile* profile) {
224 return new ExtensionInstallUIDefault(profile); 222 return new ExtensionInstallUIDefault(profile);
225 } 223 }
226 224
227 // static 225 // static
228 void ExtensionInstallUI::OpenAppInstalledUI(Browser* browser, 226 void ExtensionInstallUI::OpenAppInstalledUI(Browser* browser,
229 const std::string& app_id) { 227 const std::string& app_id) {
230 #if defined(OS_CHROMEOS) 228 #if defined(OS_CHROMEOS)
231 chrome::ShowAppList(browser->profile()); 229 AppListService::Get()->ShowAppList(browser->profile());
232 230
233 content::NotificationService::current()->Notify( 231 content::NotificationService::current()->Notify(
234 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, 232 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST,
235 content::Source<Profile>(browser->profile()), 233 content::Source<Profile>(browser->profile()),
236 content::Details<const std::string>(&app_id)); 234 content::Details<const std::string>(&app_id));
237 #else 235 #else
238 if (browser->tab_strip_model()->count() == 0) 236 if (browser->tab_strip_model()->count() == 0)
239 chrome::AddBlankTabAt(browser, -1, true); 237 chrome::AddBlankTabAt(browser, -1, true);
240 browser->window()->Show(); 238 browser->window()->Show();
241 239
(...skipping 22 matching lines...) Expand all
264 return new ExtensionInstallPrompt(web_contents); 262 return new ExtensionInstallPrompt(web_contents);
265 } 263 }
266 264
267 // static 265 // static
268 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( 266 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile(
269 Profile* profile) { 267 Profile* profile) {
270 Browser* browser = chrome::FindLastActiveWithProfile(profile, 268 Browser* browser = chrome::FindLastActiveWithProfile(profile,
271 chrome::GetActiveDesktop()); 269 chrome::GetActiveDesktop());
272 return CreateInstallPromptWithBrowser(browser); 270 return CreateInstallPromptWithBrowser(browser);
273 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698