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

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

Issue 1087713002: [Reland] [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finnur's 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..5f423e1964a59f1f4493ece571a608ee5a4af9a2 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,9 @@ 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),
+ weak_ptr_factory_(this) {
if (model_) // |model_| can be null in unittests.
model_observer_.Add(model_);
@@ -631,6 +635,18 @@ 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_) {
+ checked_extension_bubble_ = true;
+ // CreateActions() can be called as part of the browser window set up, which
+ // we need to let finish before showing the actions.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&ToolbarActionsBar::MaybeShowExtensionBubble,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
}
void ToolbarActionsBar::DeleteActions() {
@@ -729,6 +745,15 @@ bool ToolbarActionsBar::ShouldShowInfoBubble() {
return true;
}
+void ToolbarActionsBar::MaybeShowExtensionBubble() {
+ 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) {
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698