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

Unified Diff: chrome/browser/views/location_bar/location_bar_view.cc

Issue 3042010: Fixes for first run path.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « chrome/browser/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/location_bar/location_bar_view.cc
===================================================================
--- chrome/browser/views/location_bar/location_bar_view.cc (revision 53256)
+++ chrome/browser/views/location_bar/location_bar_view.cc (working copy)
@@ -99,7 +99,8 @@
star_view_(NULL),
mode_(mode),
show_focus_rect_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(first_run_bubble_(this)) {
+ bubble_type_(FirstRun::MINIMALBUBBLE),
+ template_url_model_(NULL) {
DCHECK(profile_);
SetID(VIEW_ID_LOCATION_BAR);
SetFocusable(true);
@@ -109,6 +110,8 @@
}
LocationBarView::~LocationBarView() {
+ if (template_url_model_)
+ template_url_model_->RemoveObserver(this);
}
void LocationBarView::Init() {
@@ -946,10 +949,15 @@
// LocationBarView, LocationBar implementation:
void LocationBarView::ShowFirstRunBubble(FirstRun::BubbleType bubble_type) {
- // We wait 30 milliseconds to open. It allows less flicker.
- Task* task = first_run_bubble_.NewRunnableMethod(
- &LocationBarView::ShowFirstRunBubbleInternal, bubble_type);
- MessageLoop::current()->PostDelayedTask(FROM_HERE, task, 30);
+ // Wait until search engines have loaded to show the first run bubble.
+ if (!profile_->GetTemplateURLModel()->loaded()) {
+ bubble_type_ = bubble_type;
+ template_url_model_ = profile_->GetTemplateURLModel();
+ template_url_model_->AddObserver(this);
+ template_url_model_->Load();
+ return;
+ }
+ ShowFirstRunBubbleInternal(bubble_type);
}
std::wstring LocationBarView::GetInputString() const {
@@ -1035,3 +1043,10 @@
NOTREACHED();
}
+
+void LocationBarView::OnTemplateURLModelChanged() {
+ template_url_model_->RemoveObserver(this);
+ template_url_model_ = NULL;
+ ShowFirstRunBubble(bubble_type_);
+}
+
« no previous file with comments | « chrome/browser/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698