| 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 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/common/extensions/extension_resource.h" | 34 #include "chrome/common/extensions/extension_resource.h" |
| 35 #include "chrome/common/extensions/url_pattern.h" | 35 #include "chrome/common/extensions/url_pattern.h" |
| 36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 38 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
| 39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
| 40 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
| 41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 43 | 43 |
| 44 using content::WebContents; |
| 45 |
| 44 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 46 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
| 45 0, | 47 0, |
| 46 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, | 48 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, |
| 47 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, | 49 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, |
| 48 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE | 50 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE |
| 49 }; | 51 }; |
| 50 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 52 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
| 51 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 53 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
| 52 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 54 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
| 53 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, | 55 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 355 |
| 354 // static | 356 // static |
| 355 void ExtensionInstallUI::OpenAppInstalledNTP(Browser* browser, | 357 void ExtensionInstallUI::OpenAppInstalledNTP(Browser* browser, |
| 356 const std::string& app_id) { | 358 const std::string& app_id) { |
| 357 browser::NavigateParams params = | 359 browser::NavigateParams params = |
| 358 browser->GetSingletonTabNavigateParams(GURL(chrome::kChromeUINewTabURL)); | 360 browser->GetSingletonTabNavigateParams(GURL(chrome::kChromeUINewTabURL)); |
| 359 browser::Navigate(¶ms); | 361 browser::Navigate(¶ms); |
| 360 | 362 |
| 361 content::NotificationService::current()->Notify( | 363 content::NotificationService::current()->Notify( |
| 362 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, | 364 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
| 363 content::Source<TabContents>(params.target_contents->tab_contents()), | 365 content::Source<WebContents>(params.target_contents->web_contents()), |
| 364 content::Details<const std::string>(&app_id)); | 366 content::Details<const std::string>(&app_id)); |
| 365 } | 367 } |
| 366 | 368 |
| 367 // static | 369 // static |
| 368 void ExtensionInstallUI::DisableFailureUIForTests() { | 370 void ExtensionInstallUI::DisableFailureUIForTests() { |
| 369 disable_failure_ui_for_tests = true; | 371 disable_failure_ui_for_tests = true; |
| 370 } | 372 } |
| 371 | 373 |
| 372 void ExtensionInstallUI::ShowThemeInfoBar(const std::string& previous_theme_id, | 374 void ExtensionInstallUI::ShowThemeInfoBar(const std::string& previous_theme_id, |
| 373 bool previous_using_native_theme, | 375 bool previous_using_native_theme, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 bool previous_using_native_theme) { | 433 bool previous_using_native_theme) { |
| 432 Profile* profile = tab_contents->profile(); | 434 Profile* profile = tab_contents->profile(); |
| 433 return new ThemeInstalledInfoBarDelegate( | 435 return new ThemeInstalledInfoBarDelegate( |
| 434 tab_contents->infobar_tab_helper(), | 436 tab_contents->infobar_tab_helper(), |
| 435 profile->GetExtensionService(), | 437 profile->GetExtensionService(), |
| 436 ThemeServiceFactory::GetForProfile(profile), | 438 ThemeServiceFactory::GetForProfile(profile), |
| 437 new_theme, | 439 new_theme, |
| 438 previous_theme_id, | 440 previous_theme_id, |
| 439 previous_using_native_theme); | 441 previous_using_native_theme); |
| 440 } | 442 } |
| OLD | NEW |