From 18b8d7c19768972e78211a05f0bbd680403533ae Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Fri, 9 Oct 2009 04:44:37 +0000 Subject: Revert r28519-28523. Accidentally used wrong command, committing a bunch of local changes individually with bad commit messages. TBR=rafaelw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28525 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/extension_install_ui.cc | 10 +-- .../gtk_theme_installed_infobar_delegate.cc | 25 ------- .../gtk_theme_installed_infobar_delegate.h | 29 --------- .../gtk_theme_preview_infobar_delegate.cc | 25 +++++++ .../gtk_theme_preview_infobar_delegate.h | 27 ++++++++ .../extensions/theme_installed_infobar_delegate.cc | 76 ---------------------- .../extensions/theme_installed_infobar_delegate.h | 38 ----------- .../extensions/theme_preview_infobar_delegate.cc | 75 +++++++++++++++++++++ .../extensions/theme_preview_infobar_delegate.h | 41 ++++++++++++ 9 files changed, 173 insertions(+), 173 deletions(-) delete mode 100644 chrome/browser/extensions/gtk_theme_installed_infobar_delegate.cc delete mode 100644 chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h create mode 100644 chrome/browser/extensions/gtk_theme_preview_infobar_delegate.cc create mode 100644 chrome/browser/extensions/gtk_theme_preview_infobar_delegate.h delete mode 100644 chrome/browser/extensions/theme_installed_infobar_delegate.cc delete mode 100644 chrome/browser/extensions/theme_installed_infobar_delegate.h create mode 100644 chrome/browser/extensions/theme_preview_infobar_delegate.cc create mode 100644 chrome/browser/extensions/theme_preview_infobar_delegate.h (limited to 'chrome/browser/extensions') diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index d044bf0..457dbad 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -12,7 +12,7 @@ #include "base/rand_util.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_window.h" -#include "chrome/browser/extensions/theme_installed_infobar_delegate.h" +#include "chrome/browser/extensions/theme_preview_infobar_delegate.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/extensions/extension.h" @@ -27,7 +27,7 @@ #include "base/sys_string_conversions.h" #include #elif defined(TOOLKIT_GTK) -#include "chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h" +#include "chrome/browser/extensions/gtk_theme_preview_infobar_delegate.h" #include "chrome/browser/gtk/gtk_theme_provider.h" #endif @@ -231,12 +231,12 @@ void ExtensionInstallUI::ShowThemeInfoBar(Extension* new_theme) { // Then either replace that old one or add a new one. InfoBarDelegate* new_delegate = #if defined(TOOLKIT_GTK) - new GtkThemeInstalledInfoBarDelegate( + new GtkThemePreviewInfobarDelegate( tab_contents, new_theme->name(), previous_theme_id_, previous_use_gtk_theme_); #else - new ThemeInstalledInfoBarDelegate(tab_contents, - new_theme->name(), previous_theme_id_); + new ThemePreviewInfobarDelegate(tab_contents, + new_theme->name(), previous_theme_id_); #endif if (old_delegate) diff --git a/chrome/browser/extensions/gtk_theme_installed_infobar_delegate.cc b/chrome/browser/extensions/gtk_theme_installed_infobar_delegate.cc deleted file mode 100644 index f964ca4..0000000 --- a/chrome/browser/extensions/gtk_theme_installed_infobar_delegate.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h" - -#include "chrome/browser/profile.h" - -GtkThemeInstalledInfoBarDelegate::GtkThemeInstalledInfoBarDelegate( - TabContents* tab_contents, - const std::string& name, - const std::string& previous_theme, - bool previous_use_gtk_theme) - : ThemeInstalledInfoBarDelegate(tab_contents, name, previous_theme), - previous_use_gtk_theme_(previous_use_gtk_theme) { -} - -bool GtkThemeInstalledInfoBarDelegate::Cancel() { - if (previous_use_gtk_theme_) { - profile()->SetNativeTheme(); - return true; - } else { - return ThemeInstalledInfoBarDelegate::Cancel(); - } -} diff --git a/chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h b/chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h deleted file mode 100644 index 75ea2da..0000000 --- a/chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_GTK_THEME_INSTALLED_INFOBAR_DELEGATE_H_ -#define CHROME_BROWSER_VIEWS_EXTENSIONS_GTK_THEME_INSTALLED_INFOBAR_DELEGATE_H_ - -#include "chrome/browser/extensions/theme_installed_infobar_delegate.h" - -#include - -class SkBitmap; -class TabContents; - -// A specialization of ThemeInstalledInfoBarDelegate to make "Undo" reset to the -// GTK theme if the user was in GTK theme mode before installing the theme. -class GtkThemeInstalledInfoBarDelegate : public ThemeInstalledInfoBarDelegate { - public: - GtkThemeInstalledInfoBarDelegate(TabContents* tab_contents, - const std::string& name, - const std::string& previous_theme, - bool previous_use_gtk_theme); - virtual bool Cancel(); - - private: - bool previous_use_gtk_theme_; -}; - -#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_GTK_THEME_INSTALLED_INFOBAR_DELEGATE_H_ diff --git a/chrome/browser/extensions/gtk_theme_preview_infobar_delegate.cc b/chrome/browser/extensions/gtk_theme_preview_infobar_delegate.cc new file mode 100644 index 0000000..e577158 --- /dev/null +++ b/chrome/browser/extensions/gtk_theme_preview_infobar_delegate.cc @@ -0,0 +1,25 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/gtk_theme_preview_infobar_delegate.h" + +#include "chrome/browser/profile.h" + +GtkThemePreviewInfobarDelegate::GtkThemePreviewInfobarDelegate( + TabContents* tab_contents, + const std::string& name, + const std::string& previous_theme, + bool previous_use_gtk_theme) + : ThemePreviewInfobarDelegate(tab_contents, name, previous_theme), + previous_use_gtk_theme_(previous_use_gtk_theme) { +} + +bool GtkThemePreviewInfobarDelegate::Cancel() { + if (previous_use_gtk_theme_) { + profile()->SetNativeTheme(); + return true; + } else { + return ThemePreviewInfobarDelegate::Cancel(); + } +} diff --git a/chrome/browser/extensions/gtk_theme_preview_infobar_delegate.h b/chrome/browser/extensions/gtk_theme_preview_infobar_delegate.h new file mode 100644 index 0000000..cfc213de --- /dev/null +++ b/chrome/browser/extensions/gtk_theme_preview_infobar_delegate.h @@ -0,0 +1,27 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_GTK_THEME_PREVIEW_INFOBAR_DELEGATE_H_ +#define CHROME_BROWSER_VIEWS_EXTENSIONS_GTK_THEME_PREVIEW_INFOBAR_DELEGATE_H_ + +#include "chrome/browser/extensions/theme_preview_infobar_delegate.h" + +class SkBitmap; +class TabContents; + +// A specialization of ThemePreviewInfobarDelegate to make "Undo" reset to the +// GTK theme if the user was in GTK theme mode before installing the theme. +class GtkThemePreviewInfobarDelegate : public ThemePreviewInfobarDelegate { + public: + GtkThemePreviewInfobarDelegate(TabContents* tab_contents, + const std::string& name, + const std::string& previous_theme, + bool previous_use_gtk_theme); + virtual bool Cancel(); + + private: + bool previous_use_gtk_theme_; +}; + +#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_GTK_THEME_PREVIEW_INFOBAR_DELEGATE_H_ diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc deleted file mode 100644 index 2084548..0000000 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/theme_installed_infobar_delegate.h" - -#include "app/l10n_util.h" -#include "app/resource_bundle.h" -#include "base/string_util.h" -#include "chrome/browser/extensions/extensions_service.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/common/extensions/extension.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" - -ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( - TabContents* tab_contents, const std::string& name, - const std::string& previous_theme_id) - : ConfirmInfoBarDelegate(tab_contents), - profile_(tab_contents->profile()), - name_(name), - previous_theme_id_(previous_theme_id) { -} - -void ThemeInstalledInfoBarDelegate::InfoBarClosed() { - delete this; -} - -std::wstring ThemeInstalledInfoBarDelegate::GetMessageText() const { - return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL, - UTF8ToWide(name_)); -} - -SkBitmap* ThemeInstalledInfoBarDelegate::GetIcon() const { - // TODO(aa): Reply with the theme's icon, but this requires reading it - // asynchronously from disk. - return ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_INFOBAR_THEME); -} - -ThemeInstalledInfoBarDelegate* - ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() { - return this; -} - -int ThemeInstalledInfoBarDelegate::GetButtons() const { - return BUTTON_CANCEL; -} - -std::wstring ThemeInstalledInfoBarDelegate::GetButtonLabel( - ConfirmInfoBarDelegate::InfoBarButton button) const { - switch (button) { - case BUTTON_CANCEL: { - return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); - } - default: - return L""; - } -} - -bool ThemeInstalledInfoBarDelegate::Cancel() { - if (!previous_theme_id_.empty()) { - ExtensionsService* service = profile_->GetExtensionsService(); - if (service) { - Extension* previous_theme = service->GetExtensionById(previous_theme_id_); - if (previous_theme) { - profile_->SetTheme(previous_theme); - return true; - } - } - } - - profile_->ClearTheme(); - return true; -} diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.h b/chrome/browser/extensions/theme_installed_infobar_delegate.h deleted file mode 100644 index 594764a..0000000 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ -#define CHROME_BROWSER_VIEWS_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ - -#include "chrome/browser/tab_contents/infobar_delegate.h" - -class SkBitmap; -class TabContents; - -// When a user installs a theme, we display it immediately, but provide an -// infobar allowing them to cancel. -class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate { - public: - ThemeInstalledInfoBarDelegate(TabContents* tab_contents, - const std::string& name, - const std::string& previous_theme); - virtual void InfoBarClosed(); - virtual std::wstring GetMessageText() const; - virtual SkBitmap* GetIcon() const; - virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate(); - virtual int GetButtons() const; - virtual std::wstring GetButtonLabel( - ConfirmInfoBarDelegate::InfoBarButton button) const; - virtual bool Cancel(); - - protected: - Profile* profile() { return profile_; } - - private: - Profile* profile_; - std::string name_; // name of theme to install - std::string previous_theme_id_; // used to undo theme install -}; - -#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_ diff --git a/chrome/browser/extensions/theme_preview_infobar_delegate.cc b/chrome/browser/extensions/theme_preview_infobar_delegate.cc new file mode 100644 index 0000000..06b8ed6 --- /dev/null +++ b/chrome/browser/extensions/theme_preview_infobar_delegate.cc @@ -0,0 +1,75 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/theme_preview_infobar_delegate.h" + +#include "app/l10n_util.h" +#include "app/resource_bundle.h" +#include "base/string_util.h" +#include "chrome/browser/extensions/extensions_service.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/extensions/extension.h" +#include "grit/generated_resources.h" +#include "grit/theme_resources.h" + +ThemePreviewInfobarDelegate::ThemePreviewInfobarDelegate( + TabContents* tab_contents, const std::string& name, + const std::string& previous_theme_id) + : ConfirmInfoBarDelegate(tab_contents), + profile_(tab_contents->profile()), name_(name), + previous_theme_id_(previous_theme_id) { +} + +void ThemePreviewInfobarDelegate::InfoBarClosed() { + delete this; +} + +std::wstring ThemePreviewInfobarDelegate::GetMessageText() const { + return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL, + UTF8ToWide(name_)); +} + +SkBitmap* ThemePreviewInfobarDelegate::GetIcon() const { + // TODO(aa): Reply with the theme's icon, but this requires reading it + // asynchronously from disk. + return ResourceBundle::GetSharedInstance().GetBitmapNamed( + IDR_INFOBAR_THEME); +} + +ThemePreviewInfobarDelegate* + ThemePreviewInfobarDelegate::AsThemePreviewInfobarDelegate() { + return this; +} + +int ThemePreviewInfobarDelegate::GetButtons() const { + return BUTTON_CANCEL; +} + +std::wstring ThemePreviewInfobarDelegate::GetButtonLabel( + ConfirmInfoBarDelegate::InfoBarButton button) const { + switch (button) { + case BUTTON_CANCEL: { + return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); + } + default: + return L""; + } +} + +bool ThemePreviewInfobarDelegate::Cancel() { + if (!previous_theme_id_.empty()) { + ExtensionsService* service = profile_->GetExtensionsService(); + if (service) { + Extension* previous_theme = service->GetExtensionById(previous_theme_id_); + if (previous_theme) { + profile_->SetTheme(previous_theme); + return true; + } + } + } + + profile_->ClearTheme(); + return true; +} diff --git a/chrome/browser/extensions/theme_preview_infobar_delegate.h b/chrome/browser/extensions/theme_preview_infobar_delegate.h new file mode 100644 index 0000000..fdffe07 --- /dev/null +++ b/chrome/browser/extensions/theme_preview_infobar_delegate.h @@ -0,0 +1,41 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_THEME_PREVIEW_INFOBAR_DELEGATE_H_ +#define CHROME_BROWSER_VIEWS_EXTENSIONS_THEME_PREVIEW_INFOBAR_DELEGATE_H_ + +#include "chrome/browser/tab_contents/infobar_delegate.h" + +class SkBitmap; +class TabContents; + +// When a user installs a theme, we display it immediately, but provide an +// infobar allowing them to cancel. +// +// TODO(aa): Rename this to ThemeInstalledInfoBarDelegate, since it isn't +// used for previewing anymore. +class ThemePreviewInfobarDelegate : public ConfirmInfoBarDelegate { + public: + ThemePreviewInfobarDelegate(TabContents* tab_contents, + const std::string& name, + const std::string& previous_theme); + virtual void InfoBarClosed(); + virtual std::wstring GetMessageText() const; + virtual SkBitmap* GetIcon() const; + virtual ThemePreviewInfobarDelegate* AsThemePreviewInfobarDelegate(); + virtual int GetButtons() const; + virtual std::wstring GetButtonLabel( + ConfirmInfoBarDelegate::InfoBarButton button) const; + virtual bool Cancel(); + + protected: + Profile* profile() { return profile_; } + + private: + Profile* profile_; + std::string name_; // name of theme to install + std::string previous_theme_id_; // used to undo theme install +}; + +#endif // CHROME_BROWSER_VIEWS_EXTENSIONS_THEME_PREVIEW_INFOBAR_DELEGATE_H_ -- cgit v1.1