Index: chrome/browser/extensions/settings_api_bubble_controller.cc |
diff --git a/chrome/browser/extensions/settings_api_bubble_controller.cc b/chrome/browser/extensions/settings_api_bubble_controller.cc |
index b795d88606a710b2b2c2debe2de47d34f0ed4a37..edaedfcbc818a98965a86934461ec48fb8cf53f6 100644 |
--- a/chrome/browser/extensions/settings_api_bubble_controller.cc |
+++ b/chrome/browser/extensions/settings_api_bubble_controller.cc |
@@ -6,6 +6,7 @@ |
#include "base/metrics/histogram.h" |
#include "chrome/browser/extensions/extension_service.h" |
+#include "chrome/browser/extensions/extension_toolbar_model.h" |
#include "chrome/browser/extensions/settings_api_helpers.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/startup/startup_browser_creator.h" |
@@ -17,9 +18,7 @@ |
#include "grit/generated_resources.h" |
#include "ui/base/l10n/l10n_util.h" |
-using extensions::ExtensionMessageBubbleController; |
-using extensions::SettingsApiBubbleController; |
-using extensions::SettingsOverrides; |
+namespace extensions { |
namespace { |
@@ -27,20 +26,20 @@ namespace { |
// SettingsApiBubbleDelegate |
class SettingsApiBubbleDelegate |
- : public extensions::ExtensionMessageBubbleController::Delegate { |
+ : public ExtensionMessageBubbleController::Delegate { |
public: |
explicit SettingsApiBubbleDelegate(ExtensionService* service, |
Profile* profile, |
- extensions::SettingsApiOverrideType type); |
+ SettingsApiOverrideType type); |
virtual ~SettingsApiBubbleDelegate(); |
// ExtensionMessageBubbleController::Delegate methods. |
virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE; |
virtual void AcknowledgeExtension( |
const std::string& extension_id, |
- extensions::ExtensionMessageBubbleController::BubbleAction user_action) |
- OVERRIDE; |
- virtual void PerformAction(const extensions::ExtensionIdList& list) OVERRIDE; |
+ ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE; |
+ virtual void PerformAction(const ExtensionIdList& list) OVERRIDE; |
+ virtual void OnClose() OVERRIDE; |
virtual base::string16 GetTitle() const OVERRIDE; |
virtual base::string16 GetMessageBody() const OVERRIDE; |
virtual base::string16 GetOverflowText( |
@@ -52,8 +51,7 @@ class SettingsApiBubbleDelegate |
virtual bool ShouldShowExtensionList() const OVERRIDE; |
virtual void LogExtensionCount(size_t count) OVERRIDE; |
virtual void LogAction( |
- extensions::ExtensionMessageBubbleController::BubbleAction action) |
- OVERRIDE; |
+ ExtensionMessageBubbleController::BubbleAction action) OVERRIDE; |
private: |
// Our extension service. Weak, not owned by us. |
@@ -65,7 +63,7 @@ class SettingsApiBubbleDelegate |
// The type of settings override this bubble will report on. This can be, for |
// example, a bubble to notify the user that the search engine has been |
// changed by an extension (or homepage/startup pages/etc). |
- extensions::SettingsApiOverrideType type_; |
+ SettingsApiOverrideType type_; |
// The ID of the extension we are showing the bubble for. |
std::string extension_id_; |
@@ -76,34 +74,33 @@ class SettingsApiBubbleDelegate |
SettingsApiBubbleDelegate::SettingsApiBubbleDelegate( |
ExtensionService* service, |
Profile* profile, |
- extensions::SettingsApiOverrideType type) |
+ SettingsApiOverrideType type) |
: service_(service), profile_(profile), type_(type) {} |
SettingsApiBubbleDelegate::~SettingsApiBubbleDelegate() {} |
bool SettingsApiBubbleDelegate::ShouldIncludeExtension( |
const std::string& extension_id) { |
- using extensions::ExtensionRegistry; |
ExtensionRegistry* registry = ExtensionRegistry::Get(profile_); |
- const extensions::Extension* extension = |
+ const Extension* extension = |
registry->GetExtensionById(extension_id, ExtensionRegistry::ENABLED); |
if (!extension) |
return false; // The extension provided is no longer enabled. |
- extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_); |
if (prefs->HasSettingsApiBubbleBeenAcknowledged(extension_id)) |
return false; |
- const extensions::Extension* override = NULL; |
+ const Extension* override = NULL; |
switch (type_) { |
- case extensions::BUBBLE_TYPE_HOME_PAGE: |
- override = extensions::OverridesHomepage(profile_, NULL); |
+ case BUBBLE_TYPE_HOME_PAGE: |
+ override = GetExtensionOverridingHomepage(profile_, NULL); |
break; |
- case extensions::BUBBLE_TYPE_STARTUP_PAGES: |
- override = extensions::OverridesStartupPages(profile_, NULL); |
+ case BUBBLE_TYPE_STARTUP_PAGES: |
+ override = GetExtensionOverridingStartupPages(profile_, NULL); |
break; |
- case extensions::BUBBLE_TYPE_SEARCH_ENGINE: |
- override = extensions::OverridesSearchEngine(profile_, NULL); |
+ case BUBBLE_TYPE_SEARCH_ENGINE: |
+ override = GetExtensionOverridingSearchEngine(profile_, NULL); |
break; |
} |
@@ -118,29 +115,32 @@ void SettingsApiBubbleDelegate::AcknowledgeExtension( |
const std::string& extension_id, |
ExtensionMessageBubbleController::BubbleAction user_action) { |
if (user_action != ExtensionMessageBubbleController::ACTION_EXECUTE) { |
- extensions::ExtensionPrefs* prefs = |
- extensions::ExtensionPrefs::Get(profile_); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_); |
prefs->SetSettingsApiBubbleBeenAcknowledged(extension_id, true); |
} |
} |
-void SettingsApiBubbleDelegate::PerformAction( |
- const extensions::ExtensionIdList& list) { |
+void SettingsApiBubbleDelegate::PerformAction(const ExtensionIdList& list) { |
for (size_t i = 0; i < list.size(); ++i) { |
- service_->DisableExtension(list[i], |
- extensions::Extension::DISABLE_USER_ACTION); |
+ service_->DisableExtension(list[i], Extension::DISABLE_USER_ACTION); |
} |
} |
+void SettingsApiBubbleDelegate::OnClose() { |
+ ExtensionToolbarModel* toolbar_model = ExtensionToolbarModel::Get(profile_); |
+ if (toolbar_model) |
+ toolbar_model->StopHighlighting(); |
+} |
+ |
base::string16 SettingsApiBubbleDelegate::GetTitle() const { |
switch (type_) { |
- case extensions::BUBBLE_TYPE_HOME_PAGE: |
+ case BUBBLE_TYPE_HOME_PAGE: |
return l10n_util::GetStringUTF16( |
IDS_EXTENSIONS_SETTINGS_API_TITLE_HOME_PAGE_BUBBLE); |
- case extensions::BUBBLE_TYPE_STARTUP_PAGES: |
+ case BUBBLE_TYPE_STARTUP_PAGES: |
return l10n_util::GetStringUTF16( |
IDS_EXTENSIONS_SETTINGS_API_TITLE_STARTUP_PAGES_BUBBLE); |
- case extensions::BUBBLE_TYPE_SEARCH_ENGINE: |
+ case BUBBLE_TYPE_SEARCH_ENGINE: |
return l10n_util::GetStringUTF16( |
IDS_EXTENSIONS_SETTINGS_API_TITLE_SEARCH_ENGINE_BUBBLE); |
} |
@@ -149,9 +149,8 @@ base::string16 SettingsApiBubbleDelegate::GetTitle() const { |
} |
base::string16 SettingsApiBubbleDelegate::GetMessageBody() const { |
- using extensions::ExtensionRegistry; |
ExtensionRegistry* registry = ExtensionRegistry::Get(profile_); |
- const extensions::Extension* extension = |
+ const Extension* extension = |
registry->GetExtensionById(extension_id_, ExtensionRegistry::ENABLED); |
const SettingsOverrides* settings = |
extension ? SettingsOverrides::Get(extension) : NULL; |
@@ -166,7 +165,7 @@ base::string16 SettingsApiBubbleDelegate::GetMessageBody() const { |
base::string16 body; |
switch (type_) { |
- case extensions::BUBBLE_TYPE_HOME_PAGE: |
+ case BUBBLE_TYPE_HOME_PAGE: |
body = l10n_util::GetStringUTF16( |
IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_HOME_PAGE); |
if (startup_change && search_change) { |
@@ -180,7 +179,7 @@ base::string16 SettingsApiBubbleDelegate::GetMessageBody() const { |
IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE); |
} |
break; |
- case extensions::BUBBLE_TYPE_STARTUP_PAGES: |
+ case BUBBLE_TYPE_STARTUP_PAGES: |
body = l10n_util::GetStringUTF16( |
IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_START_PAGES); |
if (home_change && search_change) { |
@@ -194,7 +193,7 @@ base::string16 SettingsApiBubbleDelegate::GetMessageBody() const { |
IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE); |
} |
break; |
- case extensions::BUBBLE_TYPE_SEARCH_ENGINE: |
+ case BUBBLE_TYPE_SEARCH_ENGINE: |
body = l10n_util::GetStringUTF16( |
IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_SEARCH_ENGINE); |
if (startup_change && home_change) { |
@@ -248,19 +247,19 @@ void SettingsApiBubbleDelegate::LogExtensionCount(size_t count) { |
void SettingsApiBubbleDelegate::LogAction( |
ExtensionMessageBubbleController::BubbleAction action) { |
switch (type_) { |
- case extensions::BUBBLE_TYPE_HOME_PAGE: |
+ case BUBBLE_TYPE_HOME_PAGE: |
UMA_HISTOGRAM_ENUMERATION( |
"ExtensionOverrideBubble.SettingsApiUserSelectionHomePage", |
action, |
ExtensionMessageBubbleController::ACTION_BOUNDARY); |
break; |
- case extensions::BUBBLE_TYPE_STARTUP_PAGES: |
+ case BUBBLE_TYPE_STARTUP_PAGES: |
UMA_HISTOGRAM_ENUMERATION( |
"ExtensionOverrideBubble.SettingsApiUserSelectionStartupPage", |
action, |
ExtensionMessageBubbleController::ACTION_BOUNDARY); |
break; |
- case extensions::BUBBLE_TYPE_SEARCH_ENGINE: |
+ case BUBBLE_TYPE_SEARCH_ENGINE: |
UMA_HISTOGRAM_ENUMERATION( |
"ExtensionOverrideBubble.SettingsApiUserSelectionSearchEngine", |
action, |
@@ -271,8 +270,6 @@ void SettingsApiBubbleDelegate::LogAction( |
} // namespace |
-namespace extensions { |
- |
//////////////////////////////////////////////////////////////////////////////// |
// SettingsApiBubbleController |
@@ -291,7 +288,7 @@ SettingsApiBubbleController::SettingsApiBubbleController( |
SettingsApiBubbleController::~SettingsApiBubbleController() {} |
bool SettingsApiBubbleController::ShouldShow(const std::string& extension_id) { |
- extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_); |
if (prefs->HasSettingsApiBubbleBeenAcknowledged(extension_id)) |
return false; |