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

Unified Diff: chrome/browser/browser.cc

Issue 334019: Lazily create the find bar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/browser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser.cc
===================================================================
--- chrome/browser/browser.cc (revision 30426)
+++ chrome/browser/browser.cc (working copy)
@@ -246,10 +246,6 @@
local_state->ClearPref(prefs::kShouldShowFirstRunBubble);
window_->GetLocationBar()->ShowFirstRunBubble(show_OEM_bubble);
}
-
- FindBar* find_bar = BrowserWindow::CreateFindBar(this);
- find_bar_controller_.reset(new FindBarController(find_bar));
- find_bar->SetFindBarController(find_bar_controller_.get());
}
///////////////////////////////////////////////////////////////////////////////
@@ -264,6 +260,17 @@
g_browser_process->user_data_dir_profiles() = profiles;
}
+FindBarController* Browser::GetFindBarController() {
+ if (!find_bar_controller_.get()) {
+ FindBar* find_bar = BrowserWindow::CreateFindBar(this);
+ find_bar_controller_.reset(new FindBarController(find_bar));
+ find_bar->SetFindBarController(find_bar_controller_.get());
+ find_bar_controller_->ChangeTabContents(GetSelectedTabContents());
+ find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true);
+ }
+ return find_bar_controller_.get();
+}
+
///////////////////////////////////////////////////////////////////////////////
// Browser, Creation Helpers:
@@ -944,7 +951,7 @@
}
void Browser::ShowFindBar() {
- find_bar_controller_->Show();
+ GetFindBarController()->Show();
}
bool Browser::SupportsWindowFeature(WindowFeature feature) const {
@@ -1772,8 +1779,7 @@
if (find_bar_controller_.get()) {
find_bar_controller_->ChangeTabContents(new_contents);
- find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(),
- true);
+ find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true);
}
// Update sessions. Don't force creation of sessions. If sessions doesn't
« no previous file with comments | « chrome/browser/browser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698