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

Side by Side Diff: chrome/browser/ui/views/avatar_menu_button.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 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
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/avatar_menu_button.h" 5 #include "chrome/browser/ui/views/avatar_menu_button.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/managed_mode.h" 10 #include "chrome/browser/managed_mode.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 int dst_height = Round(button_icon_.height() * scale); 126 int dst_height = Round(button_icon_.height() * scale);
127 // Round rather than truncating, so that for odd heights we select an extra 127 // Round rather than truncating, so that for odd heights we select an extra
128 // pixel below the image center rather than above. This is because the 128 // pixel below the image center rather than above. This is because the
129 // incognito image has shadows at the top that make the apparent center below 129 // incognito image has shadows at the top that make the apparent center below
130 // the real center. 130 // the real center.
131 int dst_y = Round((height() - dst_height) / 2.0); 131 int dst_y = Round((height() - dst_height) / 2.0);
132 canvas->DrawImageInt(button_icon_, 0, 0, button_icon_.width(), 132 canvas->DrawImageInt(button_icon_, 0, 0, button_icon_.width(),
133 button_icon_.height(), dst_x, dst_y, dst_width, dst_height, false); 133 button_icon_.height(), dst_x, dst_y, dst_width, dst_height, false);
134 } 134 }
135 135
136 bool AvatarMenuButton::HitTest(const gfx::Point& point) const { 136 bool AvatarMenuButton::HitTestRect(const gfx::Rect& rect) const {
137 if (incognito_) 137 if (incognito_)
138 return false; 138 return false;
139 return views::MenuButton::HitTest(point); 139 return views::MenuButton::HitTestRect(rect);
140 } 140 }
141 141
142 void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon, 142 void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
143 bool is_gaia_picture) { 143 bool is_gaia_picture) {
144 icon_.reset(new gfx::Image(icon)); 144 icon_.reset(new gfx::Image(icon));
145 button_icon_ = gfx::ImageSkia(); 145 button_icon_ = gfx::ImageSkia();
146 is_gaia_picture_ = is_gaia_picture; 146 is_gaia_picture_ = is_gaia_picture;
147 SchedulePaint(); 147 SchedulePaint();
148 } 148 }
149 149
(...skipping 16 matching lines...) Expand all
166 views::View::ConvertPointToScreen(this, &origin); 166 views::View::ConvertPointToScreen(this, &origin);
167 gfx::Rect bounds(origin, size()); 167 gfx::Rect bounds(origin, size());
168 168
169 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, 169 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this,
170 views::BubbleBorder::TOP_LEFT, bounds, browser_); 170 views::BubbleBorder::TOP_LEFT, bounds, browser_);
171 views::BubbleDelegateView::CreateBubble(bubble); 171 views::BubbleDelegateView::CreateBubble(bubble);
172 bubble->Show(); 172 bubble->Show();
173 173
174 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); 174 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
175 } 175 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_button.h ('k') | chrome/browser/ui/views/content_setting_bubble_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698