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

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

Issue 1881773002: [Extensions UI] Convert ExtensionMessageBubbles to ToolbarActionsBarBubbles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 eda0c430c952270e13435f968029cc020e379d7f..bd3d27d3a61e5b8430358e1f8cdde9f2d24de620 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc
@@ -11,6 +11,7 @@
#include "base/profiler/scoped_tracker.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
+#include "base/time/time.h"
#include "chrome/browser/extensions/extension_message_bubble_controller.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -103,6 +104,9 @@ void SortContainer(std::vector<Type1>* to_sort,
}
}
+// How long to wait until showing an extension message bubble.
+int g_extension_bubble_appearance_wait_time_in_seconds = 5;
+
} // namespace
// static
@@ -611,8 +615,29 @@ void ToolbarActionsBar::MaybeShowExtensionBubble(
return;
controller->HighlightExtensionsIfNecessary(); // Safe to call multiple times.
- ShowToolbarActionBubble(scoped_ptr<ToolbarActionsBarBubbleDelegate>(
- new ExtensionMessageBubbleBridge(std::move(controller))));
+
+ // Not showing the bubble right away (during startup) has a few benefits:
+ // We don't have to worry about focus being lost due to the Omnibox (or to
+ // other things that want focus at startup). This allows Esc to work to close
+ // the bubble and also solves the keyboard accessibility problem that comes
+ // with focus being lost (we don't have a good generic mechanism of injecting
+ // bubbles into the focus cycle). Another benefit of delaying the show is
+ // that fade-in works (the fade-in isn't apparent if the the bubble appears at
+ // startup).
+ std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate(
+ new ExtensionMessageBubbleBridge(std::move(controller)));
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::Bind(&ToolbarActionsBar::ShowToolbarActionBubble,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Passed(std::move(delegate))),
+ base::TimeDelta::FromSeconds(
+ g_extension_bubble_appearance_wait_time_in_seconds));
+}
+
+// static
+void ToolbarActionsBar::set_extension_bubble_appearance_wait_time_for_testing(
+ int time_in_seconds) {
+ g_extension_bubble_appearance_wait_time_in_seconds = time_in_seconds;
}
void ToolbarActionsBar::OnToolbarActionAdded(
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698