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

Side by Side Diff: chrome/browser/browser.cc

Issue 371011: Attempt at fixing crash when showing bookmark model. The crash... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/keyboard_codes.h" 10 #include "base/keyboard_codes.h"
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 BookmarkModel* model = profile()->GetBookmarkModel(); 942 BookmarkModel* model = profile()->GetBookmarkModel();
943 if (!model || !model->IsLoaded()) 943 if (!model || !model->IsLoaded())
944 return; // Ignore requests until bookmarks are loaded. 944 return; // Ignore requests until bookmarks are loaded.
945 945
946 GURL url; 946 GURL url;
947 std::wstring title; 947 std::wstring title;
948 bookmark_utils::GetURLAndTitleToBookmark(GetSelectedTabContents(), &url, 948 bookmark_utils::GetURLAndTitleToBookmark(GetSelectedTabContents(), &url,
949 &title); 949 &title);
950 bool was_bookmarked = model->IsBookmarked(url); 950 bool was_bookmarked = model->IsBookmarked(url);
951 model->SetURLStarred(url, title, true); 951 model->SetURLStarred(url, title, true);
952 if (window_->IsActive()) { 952 // Make sure the model actually added a bookmark before showing the star. A
953 // bookmark isn't created if the url is invalid.
954 if (window_->IsActive() && model->IsBookmarked(url)) {
953 // Only show the bubble if the window is active, otherwise we may get into 955 // Only show the bubble if the window is active, otherwise we may get into
954 // weird situations were the bubble is deleted as soon as it is shown. 956 // weird situations were the bubble is deleted as soon as it is shown.
955 window_->ShowBookmarkBubble(url, was_bookmarked); 957 window_->ShowBookmarkBubble(url, was_bookmarked);
956 } 958 }
957 } 959 }
958 960
959 void Browser::SavePage() { 961 void Browser::SavePage() {
960 UserMetrics::RecordAction(L"SavePage", profile_); 962 UserMetrics::RecordAction(L"SavePage", profile_);
961 GetSelectedTabContents()->OnSavePage(); 963 GetSelectedTabContents()->OnSavePage();
962 } 964 }
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 /////////////////////////////////////////////////////////////////////////////// 2986 ///////////////////////////////////////////////////////////////////////////////
2985 // BrowserToolbarModel (private): 2987 // BrowserToolbarModel (private):
2986 2988
2987 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2989 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2988 // This |current_tab| can be NULL during the initialization of the 2990 // This |current_tab| can be NULL during the initialization of the
2989 // toolbar during window creation (i.e. before any tabs have been added 2991 // toolbar during window creation (i.e. before any tabs have been added
2990 // to the window). 2992 // to the window).
2991 TabContents* current_tab = browser_->GetSelectedTabContents(); 2993 TabContents* current_tab = browser_->GetSelectedTabContents();
2992 return current_tab ? &current_tab->controller() : NULL; 2994 return current_tab ? &current_tab->controller() : NULL;
2993 } 2995 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698