Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1404)

Unified Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.cc

Issue 1078543002: [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/toolbar_actions_bar.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc
index be3687c9fbfca7db2b455d6b9f3c4b49df171883..a3323ede360e26954e4b5c52dc48ae99cd3bcb2f 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc
@@ -7,12 +7,14 @@
#include "base/auto_reset.h"
#include "base/profiler/scoped_tracker.h"
#include "chrome/browser/extensions/extension_action_manager.h"
+#include "chrome/browser/extensions/extension_message_bubble_controller.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/extension_action_view_controller.h"
+#include "chrome/browser/ui/extensions/extension_message_bubble_factory.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h"
@@ -418,7 +420,8 @@ ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate,
model_observer_(this),
suppress_layout_(false),
suppress_animation_(true),
- overflowed_action_wants_to_run_(false) {
+ overflowed_action_wants_to_run_(false),
+ checked_extension_bubble_(false) {
if (model_) // |model_| can be null in unittests.
model_observer_.Add(model_);
@@ -631,6 +634,11 @@ void ToolbarActionsBar::CreateActions() {
// Once the actions are created, we should animate the changes.
suppress_animation_ = false;
+
+ // CreateActions() can be called multiple times, so we need to make sure we
+ // haven't already shown the bubble.
+ if (!checked_extension_bubble_)
+ MaybeShowExtensionBubble();
}
void ToolbarActionsBar::DeleteActions() {
@@ -729,6 +737,16 @@ bool ToolbarActionsBar::ShouldShowInfoBubble() {
return true;
}
+void ToolbarActionsBar::MaybeShowExtensionBubble() {
+ checked_extension_bubble_ = true;
+ scoped_ptr<extensions::ExtensionMessageBubbleController> controller =
+ ExtensionMessageBubbleFactory(browser_->profile()).GetController();
+ if (controller) {
+ controller->HighlightExtensionsIfNecessary();
+ delegate_->ShowExtensionMessageBubble(controller.Pass());
+ }
+}
+
void ToolbarActionsBar::OnToolbarExtensionAdded(
const extensions::Extension* extension,
int index) {

Powered by Google App Engine
This is Rietveld 408576698