| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_install_ui.h" | 5 #include "chrome/browser/extensions/extension_install_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/ui/browser_navigator.h" | 26 #include "chrome/browser/ui/browser_navigator.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
| 30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
| 32 #include "chrome/common/extensions/extension_icon_set.h" | 32 #include "chrome/common/extensions/extension_icon_set.h" |
| 33 #include "chrome/common/extensions/extension_resource.h" | 33 #include "chrome/common/extensions/extension_resource.h" |
| 34 #include "chrome/common/extensions/url_pattern.h" | 34 #include "chrome/common/extensions/url_pattern.h" |
| 35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 36 #include "content/common/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 37 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
| 38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 39 #include "grit/theme_resources.h" | 39 #include "grit/theme_resources.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 42 | 42 |
| 43 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 43 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
| 44 IDS_EXTENSION_INSTALL_PROMPT_TITLE, | 44 IDS_EXTENSION_INSTALL_PROMPT_TITLE, |
| 45 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, | 45 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, |
| 46 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, | 46 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 void ExtensionInstallUI::OnImageLoaded( | 318 void ExtensionInstallUI::OnImageLoaded( |
| 319 SkBitmap* image, const ExtensionResource& resource, int index) { | 319 SkBitmap* image, const ExtensionResource& resource, int index) { |
| 320 SetIcon(image); | 320 SetIcon(image); |
| 321 | 321 |
| 322 switch (prompt_type_) { | 322 switch (prompt_type_) { |
| 323 case PERMISSIONS_PROMPT: | 323 case PERMISSIONS_PROMPT: |
| 324 case RE_ENABLE_PROMPT: | 324 case RE_ENABLE_PROMPT: |
| 325 case INSTALL_PROMPT: { | 325 case INSTALL_PROMPT: { |
| 326 NotificationService* service = NotificationService::current(); | 326 content::NotificationService* service = |
| 327 content::NotificationService::current(); |
| 327 service->Notify(chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, | 328 service->Notify(chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, |
| 328 content::Source<ExtensionInstallUI>(this), | 329 content::Source<ExtensionInstallUI>(this), |
| 329 NotificationService::NoDetails()); | 330 content::NotificationService::NoDetails()); |
| 330 | 331 |
| 331 Prompt prompt(prompt_type_); | 332 Prompt prompt(prompt_type_); |
| 332 prompt.SetPermissions(permissions_->GetWarningMessages()); | 333 prompt.SetPermissions(permissions_->GetWarningMessages()); |
| 333 ShowExtensionInstallDialog( | 334 ShowExtensionInstallDialog( |
| 334 profile_, delegate_, extension_, &icon_, prompt); | 335 profile_, delegate_, extension_, &icon_, prompt); |
| 335 break; | 336 break; |
| 336 } | 337 } |
| 337 default: | 338 default: |
| 338 NOTREACHED() << "Unknown message"; | 339 NOTREACHED() << "Unknown message"; |
| 339 break; | 340 break; |
| 340 } | 341 } |
| 341 } | 342 } |
| 342 | 343 |
| 343 // static | 344 // static |
| 344 void ExtensionInstallUI::OpenAppInstalledNTP(Browser* browser, | 345 void ExtensionInstallUI::OpenAppInstalledNTP(Browser* browser, |
| 345 const std::string& app_id) { | 346 const std::string& app_id) { |
| 346 browser::NavigateParams params = | 347 browser::NavigateParams params = |
| 347 browser->GetSingletonTabNavigateParams(GURL(chrome::kChromeUINewTabURL)); | 348 browser->GetSingletonTabNavigateParams(GURL(chrome::kChromeUINewTabURL)); |
| 348 browser::Navigate(¶ms); | 349 browser::Navigate(¶ms); |
| 349 | 350 |
| 350 NotificationService::current()->Notify( | 351 content::NotificationService::current()->Notify( |
| 351 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, | 352 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
| 352 content::Source<TabContents>(params.target_contents->tab_contents()), | 353 content::Source<TabContents>(params.target_contents->tab_contents()), |
| 353 content::Details<const std::string>(&app_id)); | 354 content::Details<const std::string>(&app_id)); |
| 354 } | 355 } |
| 355 | 356 |
| 356 // static | 357 // static |
| 357 void ExtensionInstallUI::DisableFailureUIForTests() { | 358 void ExtensionInstallUI::DisableFailureUIForTests() { |
| 358 disable_failure_ui_for_tests = true; | 359 disable_failure_ui_for_tests = true; |
| 359 } | 360 } |
| 360 | 361 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 bool previous_using_native_theme) { | 421 bool previous_using_native_theme) { |
| 421 Profile* profile = tab_contents->profile(); | 422 Profile* profile = tab_contents->profile(); |
| 422 return new ThemeInstalledInfoBarDelegate( | 423 return new ThemeInstalledInfoBarDelegate( |
| 423 tab_contents->infobar_tab_helper(), | 424 tab_contents->infobar_tab_helper(), |
| 424 profile->GetExtensionService(), | 425 profile->GetExtensionService(), |
| 425 ThemeServiceFactory::GetForProfile(profile), | 426 ThemeServiceFactory::GetForProfile(profile), |
| 426 new_theme, | 427 new_theme, |
| 427 previous_theme_id, | 428 previous_theme_id, |
| 428 previous_using_native_theme); | 429 previous_using_native_theme); |
| 429 } | 430 } |
| OLD | NEW |