Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / extensions / extension_install_ui_default.cc
index 6fa1d4a..d6cad97 100644 (file)
@@ -5,17 +5,13 @@
 #include "chrome/browser/ui/extensions/extension_install_ui_default.h"
 
 #include "base/bind.h"
-#include "base/command_line.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/extensions/extension_install_prompt.h"
 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
-#include "chrome/browser/infobars/infobar.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/prefs/incognito_mode_prefs.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/search/search.h"
 #include "chrome/browser/themes/theme_service.h"
 #include "chrome/browser/themes/theme_service_factory.h"
 #include "chrome/browser/ui/app_list/app_list_service.h"
 #include "chrome/browser/ui/simple_message_box.h"
 #include "chrome/browser/ui/singleton_tabs.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/common/chrome_switches.h"
 #include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "components/infobars/core/infobar.h"
+#include "components/search/search.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/web_contents.h"
 #include "extensions/common/extension.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
+#include "grit/components_strings.h"
 #include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
 
 #if defined(USE_ASH)
 #include "ash/shell.h"
@@ -131,11 +128,12 @@ base::string16 ErrorInfoBarDelegate::GetLinkText() const {
 }
 
 bool ErrorInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
-  web_contents()->OpenURL(content::OpenURLParams(
-      GURL("http://support.google.com/chrome_webstore/?p=crx_warning"),
-      content::Referrer(),
-      (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
-      content::PAGE_TRANSITION_LINK, false));
+  InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
+      content::OpenURLParams(
+          GURL("http://support.google.com/chrome_webstore/?p=crx_warning"),
+          content::Referrer(),
+          (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
+          ui::PAGE_TRANSITION_LINK, false));
   return false;
 }
 
@@ -203,7 +201,7 @@ ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile(
 
 ExtensionInstallUIDefault::ExtensionInstallUIDefault(Profile* profile)
     : ExtensionInstallUI(profile),
-      previous_using_native_theme_(false),
+      previous_using_system_theme_(false),
       use_app_installed_bubble_(false) {
   // |profile| can be NULL during tests.
   if (profile) {
@@ -212,15 +210,15 @@ ExtensionInstallUIDefault::ExtensionInstallUIDefault(Profile* profile)
         ThemeServiceFactory::GetThemeForProfile(profile);
     if (previous_theme)
       previous_theme_id_ = previous_theme->id();
-    previous_using_native_theme_ =
-        ThemeServiceFactory::GetForProfile(profile)->UsingNativeTheme();
+    previous_using_system_theme_ =
+        ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme();
   }
 }
 
 ExtensionInstallUIDefault::~ExtensionInstallUIDefault() {}
 
 void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension,
-                                                 SkBitmap* icon) {
+                                                 const SkBitmap* icon) {
   if (skip_post_install_ui())
     return;
 
@@ -233,7 +231,7 @@ void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension,
 
   if (extension->is_theme()) {
     ThemeInstalledInfoBarDelegate::Create(
-        extension, profile(), previous_theme_id_, previous_using_native_theme_);
+        extension, profile(), previous_theme_id_, previous_using_system_theme_);
     return;
   }
 
@@ -244,9 +242,7 @@ void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension,
     bool use_bubble = false;
 
 #if defined(TOOLKIT_VIEWS)  || defined(OS_MACOSX)
-    CommandLine* cmdline = CommandLine::ForCurrentProcess();
-    use_bubble = (use_app_installed_bubble_ ||
-                  cmdline->HasSwitch(switches::kAppsNewInstallBubble));
+    use_bubble = use_app_installed_bubble_;
 #endif
 
     if (IsAppLauncherEnabled()) {
@@ -276,7 +272,7 @@ void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension,
 
 void ExtensionInstallUIDefault::OnInstallFailure(
     const extensions::CrxInstallerError& error) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
   if (disable_failure_ui_for_tests() || skip_post_install_ui())
     return;