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

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

Issue 339005: Fix crash when a page action cannot load its icon. (Closed)
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
« 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/views/location_bar_view.h" 5 #include "chrome/browser/views/location_bar_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 1307
1308 void LocationBarView::PageActionImageView::ShowInfoBubble() { 1308 void LocationBarView::PageActionImageView::ShowInfoBubble() {
1309 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); 1309 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT));
1310 } 1310 }
1311 1311
1312 void LocationBarView::PageActionImageView::OnImageLoaded(SkBitmap* image, 1312 void LocationBarView::PageActionImageView::OnImageLoaded(SkBitmap* image,
1313 size_t index) { 1313 size_t index) {
1314 DCHECK(index < page_action_icons_.size()); 1314 DCHECK(index < page_action_icons_.size());
1315 if (index == page_action_icons_.size() - 1) 1315 if (index == page_action_icons_.size() - 1)
1316 tracker_ = NULL; // The tracker object will delete itself when we return. 1316 tracker_ = NULL; // The tracker object will delete itself when we return.
1317 page_action_icons_[index] = *image; 1317 if (image)
1318 page_action_icons_[index] = *image;
1318 owner_->UpdatePageActions(); 1319 owner_->UpdatePageActions();
1319 } 1320 }
1320 1321
1321 void LocationBarView::PageActionImageView::UpdateVisibility( 1322 void LocationBarView::PageActionImageView::UpdateVisibility(
1322 TabContents* contents, const GURL& url) { 1323 TabContents* contents, const GURL& url) {
1323 // Save this off so we can pass it back to the extension when the action gets 1324 // Save this off so we can pass it back to the extension when the action gets
1324 // executed. See PageActionImageView::OnMousePressed. 1325 // executed. See PageActionImageView::OnMousePressed.
1325 current_tab_id_ = ExtensionTabUtil::GetTabId(contents); 1326 current_tab_id_ = ExtensionTabUtil::GetTabId(contents);
1326 current_url_ = url; 1327 current_url_ = url;
1327 1328
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 } 1399 }
1399 1400
1400 int LocationBarView::PageActionVisibleCount() { 1401 int LocationBarView::PageActionVisibleCount() {
1401 int result = 0; 1402 int result = 0;
1402 for (size_t i = 0; i < page_action_views_.size(); i++) { 1403 for (size_t i = 0; i < page_action_views_.size(); i++) {
1403 if (page_action_views_[i]->IsVisible()) 1404 if (page_action_views_[i]->IsVisible())
1404 ++result; 1405 ++result;
1405 } 1406 }
1406 return result; 1407 return result;
1407 } 1408 }
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