diff options
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 61ea2da..6f5cb590 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -246,6 +246,8 @@ void Browser::CreateBrowserWindow() { // Show the First Run information bubble if we've been told to. PrefService* local_state = g_browser_process->local_state(); + if (!local_state) + return; if (local_state->IsPrefRegistered(prefs::kShouldShowFirstRunBubble) && local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { // Reset the preference so we don't show the bubble for subsequent windows. @@ -1430,10 +1432,13 @@ void Browser::TabSelectedAt(TabContents* old_contents, UpdateCommandsForTabState(); // Reset the status bubble. - GetStatusBubble()->Hide(); + StatusBubble* status_bubble = GetStatusBubble(); + if (status_bubble) { + status_bubble->Hide(); - // Show the loading state (if any). - GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); + // Show the loading state (if any). + status_bubble->SetStatus(GetSelectedTabContents()->GetStatusText()); + } // Update sessions. Don't force creation of sessions. If sessions doesn't // exist, the change will be picked up by sessions when created. @@ -1567,7 +1572,8 @@ void Browser::OpenURLFromTab(TabContents* source, // The TabContents might have changed as part of the navigation (ex: new // tab page can become WebContents). new_contents = current_tab->controller()->active_contents(); - GetStatusBubble()->Hide(); + if (GetStatusBubble()) + GetStatusBubble()->Hide(); // Synchronously update the location bar. This allows us to immediately // have the URL bar update when the user types something, rather than @@ -1681,7 +1687,8 @@ void Browser::LoadingStateChanged(TabContents* source) { if (source == GetSelectedTabContents()) { UpdateStopGoState(source->is_loading()); - GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); + if (GetStatusBubble()) + GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); } } @@ -1729,6 +1736,9 @@ void Browser::URLStarredChanged(TabContents* source, bool starred) { } void Browser::ContentsMouseEvent(TabContents* source, UINT message) { + if (!GetStatusBubble()) + return; + if (source == GetSelectedTabContents()) { if (message == WM_MOUSEMOVE) { GetStatusBubble()->MouseMoved(); @@ -1739,6 +1749,9 @@ void Browser::ContentsMouseEvent(TabContents* source, UINT message) { } void Browser::UpdateTargetURL(TabContents* source, const GURL& url) { + if (!GetStatusBubble()) + return; + if (source == GetSelectedTabContents()) { PrefService* prefs = profile_->GetPrefs(); GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages)); @@ -2052,14 +2065,22 @@ void Browser::UpdateCommandsForTabState() { } void Browser::UpdateStopGoState(bool is_loading) { - GetGoButton()->ChangeMode(is_loading ? + GoButton* go_button = GetGoButton(); + if (!go_button) + return; + + go_button->ChangeMode(is_loading ? GoButton::MODE_STOP : GoButton::MODE_GO); controller_.UpdateCommandEnabled(IDC_GO, !is_loading); controller_.UpdateCommandEnabled(IDC_STOP, is_loading); } void Browser::SetStarredButtonToggled(bool starred) { - window_->GetStarButton()->SetToggled(starred); + ToolbarStarToggle* star_button = window_->GetStarButton(); + if (!star_button) + return; + + star_button->SetToggled(starred); } /////////////////////////////////////////////////////////////////////////////// @@ -2153,7 +2174,7 @@ void Browser::ProcessPendingUIUpdates() { // Updating the URL happens synchronously in ScheduleUIUpdate. - if (flags & TabContents::INVALIDATE_LOAD) + if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble()) GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); if (invalidate_tab) { // INVALIDATE_TITLE or INVALIDATE_FAVICON. |