| OLD | NEW |
| 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" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 extension, profile_, previous_theme_id_, previous_using_native_theme_); | 168 extension, profile_, previous_theme_id_, previous_using_native_theme_); |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Extensions aren't enabled by default in incognito so we confirm | 172 // Extensions aren't enabled by default in incognito so we confirm |
| 173 // the install in a normal window. | 173 // the install in a normal window. |
| 174 Profile* current_profile = profile_->GetOriginalProfile(); | 174 Profile* current_profile = profile_->GetOriginalProfile(); |
| 175 Browser* browser = | 175 Browser* browser = |
| 176 chrome::FindOrCreateTabbedBrowser(current_profile, | 176 chrome::FindOrCreateTabbedBrowser(current_profile, |
| 177 chrome::GetActiveDesktop()); | 177 chrome::GetActiveDesktop()); |
| 178 if (browser->tab_strip_model()->count() == 0) | |
| 179 chrome::AddBlankTabAt(browser, -1, true); | |
| 180 browser->window()->Show(); | |
| 181 | |
| 182 if (extension->is_app()) { | 178 if (extension->is_app()) { |
| 183 bool use_bubble = false; | 179 bool use_bubble = false; |
| 184 | 180 |
| 185 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 181 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
| 186 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 182 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| 187 use_bubble = (use_app_installed_bubble_ || | 183 use_bubble = (use_app_installed_bubble_ || |
| 188 cmdline->HasSwitch(switches::kAppsNewInstallBubble)); | 184 cmdline->HasSwitch(switches::kAppsNewInstallBubble)); |
| 189 #endif | 185 #endif |
| 190 | 186 |
| 191 apps::GetIsAppLauncherEnabled( | 187 apps::GetIsAppLauncherEnabled( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void ExtensionInstallUI::OpenAppInstalledUI(Browser* browser, | 228 void ExtensionInstallUI::OpenAppInstalledUI(Browser* browser, |
| 233 const std::string& app_id) { | 229 const std::string& app_id) { |
| 234 #if defined(OS_CHROMEOS) | 230 #if defined(OS_CHROMEOS) |
| 235 chrome::ShowAppList(browser->profile()); | 231 chrome::ShowAppList(browser->profile()); |
| 236 | 232 |
| 237 content::NotificationService::current()->Notify( | 233 content::NotificationService::current()->Notify( |
| 238 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, | 234 chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, |
| 239 content::Source<Profile>(browser->profile()), | 235 content::Source<Profile>(browser->profile()), |
| 240 content::Details<const std::string>(&app_id)); | 236 content::Details<const std::string>(&app_id)); |
| 241 #else | 237 #else |
| 238 if (browser->tab_strip_model()->count() == 0) |
| 239 chrome::AddBlankTabAt(browser, -1, true); |
| 240 browser->window()->Show(); |
| 241 |
| 242 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 242 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 243 browser, GURL(chrome::kChromeUINewTabURL))); | 243 browser, GURL(chrome::kChromeUINewTabURL))); |
| 244 chrome::Navigate(¶ms); | 244 chrome::Navigate(¶ms); |
| 245 | 245 |
| 246 content::NotificationService::current()->Notify( | 246 content::NotificationService::current()->Notify( |
| 247 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, | 247 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
| 248 content::Source<WebContents>(params.target_contents), | 248 content::Source<WebContents>(params.target_contents), |
| 249 content::Details<const std::string>(&app_id)); | 249 content::Details<const std::string>(&app_id)); |
| 250 #endif | 250 #endif |
| 251 } | 251 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 264 return new ExtensionInstallPrompt(web_contents); | 264 return new ExtensionInstallPrompt(web_contents); |
| 265 } | 265 } |
| 266 | 266 |
| 267 // static | 267 // static |
| 268 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( | 268 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( |
| 269 Profile* profile) { | 269 Profile* profile) { |
| 270 Browser* browser = chrome::FindLastActiveWithProfile(profile, | 270 Browser* browser = chrome::FindLastActiveWithProfile(profile, |
| 271 chrome::GetActiveDesktop()); | 271 chrome::GetActiveDesktop()); |
| 272 return CreateInstallPromptWithBrowser(browser); | 272 return CreateInstallPromptWithBrowser(browser); |
| 273 } | 273 } |
| OLD | NEW |