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

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_action_view.cc

Issue 608013002: Fix regression where extension action icons may not be displayed properly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/views/toolbar/browser_action_view.h" 5 #include "chrome/browser/ui/views/toolbar/browser_action_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); 147 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
148 } 148 }
149 149
150 // If the browser action name is empty, show the extension name instead. 150 // If the browser action name is empty, show the extension name instead.
151 std::string title = extension_action()->GetTitle(tab_id); 151 std::string title = extension_action()->GetTitle(tab_id);
152 base::string16 name = 152 base::string16 name =
153 base::UTF8ToUTF16(title.empty() ? extension()->name() : title); 153 base::UTF8ToUTF16(title.empty() ? extension()->name() : title);
154 SetTooltipText(name); 154 SetTooltipText(name);
155 SetAccessibleName(name); 155 SetAccessibleName(name);
156 156
157 Layout(); // We need to layout since we may have added an icon as a result.
157 SchedulePaint(); 158 SchedulePaint();
158 } 159 }
159 160
160 bool BrowserActionView::IsPopup() { 161 bool BrowserActionView::IsPopup() {
161 int tab_id = view_controller_->GetCurrentTabId(); 162 int tab_id = view_controller_->GetCurrentTabId();
162 return (tab_id < 0) ? false : extension_action()->HasPopup(tab_id); 163 return (tab_id < 0) ? false : extension_action()->HasPopup(tab_id);
163 } 164 }
164 165
165 void BrowserActionView::Observe(int type, 166 void BrowserActionView::Observe(int type,
166 const content::NotificationSource& source, 167 const content::NotificationSource& source,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 337 }
337 338
338 void BrowserActionView::CleanupPopup() { 339 void BrowserActionView::CleanupPopup() {
339 // We need to do these actions synchronously (instead of closing and then 340 // We need to do these actions synchronously (instead of closing and then
340 // performing the rest of the cleanup in OnWidgetDestroyed()) because 341 // performing the rest of the cleanup in OnWidgetDestroyed()) because
341 // OnWidgetDestroyed() can be called asynchronously from Close(), and we need 342 // OnWidgetDestroyed() can be called asynchronously from Close(), and we need
342 // to keep the delegate's popup owner up-to-date. 343 // to keep the delegate's popup owner up-to-date.
343 delegate_->SetPopupOwner(NULL); 344 delegate_->SetPopupOwner(NULL);
344 pressed_lock_.reset(); // Unpress the menu button if it was pressed. 345 pressed_lock_.reset(); // Unpress the menu button if it was pressed.
345 } 346 }
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