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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 2447553003: More pre-MD odds and ends. (Closed)
Patch Set: fix typo Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/location_bar/page_action_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_action.h" 8 #include "chrome/browser/extensions/extension_action.h"
9 #include "chrome/browser/platform_util.h" 9 #include "chrome/browser/platform_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 (!preview_enabled_ && !extension_action()->GetIsVisible(tab_id))) { 98 (!preview_enabled_ && !extension_action()->GetIsVisible(tab_id))) {
99 SetVisible(false); 99 SetVisible(false);
100 return; 100 return;
101 } 101 }
102 102
103 // Set the tooltip. 103 // Set the tooltip.
104 tooltip_ = extension_action()->GetTitle(tab_id); 104 tooltip_ = extension_action()->GetTitle(tab_id);
105 SetTooltipText(base::UTF8ToUTF16(tooltip_)); 105 SetTooltipText(base::UTF8ToUTF16(tooltip_));
106 106
107 // Set the image. 107 // Set the image.
108 gfx::Size size(extension_misc::EXTENSION_ICON_ACTION, 108 gfx::Size size(ExtensionAction::ActionIconSize(),
109 extension_misc::EXTENSION_ICON_ACTION); 109 ExtensionAction::ActionIconSize());
110 gfx::Image icon = view_controller_->GetIcon(contents, size); 110 gfx::Image icon = view_controller_->GetIcon(contents, size);
111 if (!icon.IsEmpty()) 111 if (!icon.IsEmpty())
112 SetImage(*icon.ToImageSkia()); 112 SetImage(*icon.ToImageSkia());
113 113
114 SetVisible(true); 114 SetVisible(true);
115 } 115 }
116 116
117 void PageActionImageView::UpdateState() { 117 void PageActionImageView::UpdateState() {
118 UpdateVisibility(GetCurrentWebContents()); 118 UpdateVisibility(GetCurrentWebContents());
119 } 119 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 nullptr, // No menu button for page action views. 157 nullptr, // No menu button for page action views.
158 gfx::Rect(screen_loc, size()), 158 gfx::Rect(screen_loc, size()),
159 views::MENU_ANCHOR_TOPLEFT, 159 views::MENU_ANCHOR_TOPLEFT,
160 source_type) == views::MenuRunner::MENU_DELETED) { 160 source_type) == views::MenuRunner::MENU_DELETED) {
161 return; 161 return;
162 } 162 }
163 163
164 menu_runner_.reset(); 164 menu_runner_.reset();
165 view_controller_->OnContextMenuClosed(); 165 view_controller_->OnContextMenuClosed();
166 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698