| Index: chrome/browser/ui/toolbar/toolbar_model.cc
|
| diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc
|
| index ef9d04497c9bfd0c3323f51e5b90b16a9b5d68c9..41e15dbc0cf3456a88ef439f2f62bc3a114cad70 100644
|
| --- a/chrome/browser/ui/toolbar/toolbar_model.cc
|
| +++ b/chrome/browser/ui/toolbar/toolbar_model.cc
|
| @@ -34,6 +34,13 @@ using content::WebContents;
|
|
|
| ToolbarModel::ToolbarModel(Browser* browser)
|
| : browser_(browser),
|
| + web_contents_(NULL),
|
| + input_in_progress_(false) {
|
| +}
|
| +
|
| +ToolbarModel::ToolbarModel(WebContents* web_contents)
|
| + : browser_(NULL),
|
| + web_contents_(web_contents),
|
| input_in_progress_(false) {
|
| }
|
|
|
| @@ -84,7 +91,7 @@ bool ToolbarModel::ShouldDisplayURL() const {
|
| }
|
| }
|
|
|
| - WebContents* web_contents = browser_->GetSelectedWebContents();
|
| + WebContents* web_contents = GetSelectedWebContents();
|
| if (web_contents && web_contents->GetWebUIForCurrentState())
|
| return !web_contents->GetWebUIForCurrentState()->ShouldHideURL();
|
|
|
| @@ -174,6 +181,12 @@ NavigationController* ToolbarModel::GetNavigationController() const {
|
| // This |current_tab| can be NULL during the initialization of the
|
| // toolbar during window creation (i.e. before any tabs have been added
|
| // to the window).
|
| - WebContents* current_tab = browser_->GetSelectedWebContents();
|
| + WebContents* current_tab = GetSelectedWebContents();
|
| return current_tab ? ¤t_tab->GetController() : NULL;
|
| }
|
| +
|
| +WebContents* ToolbarModel::GetSelectedWebContents() const {
|
| + if (browser_)
|
| + return browser_->GetSelectedWebContents();
|
| + return web_contents_;
|
| +}
|
|
|