| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/ui/views/avatar_menu.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 22 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
| 23 #include "views/controls/button/image_button.h" | 23 #include "views/controls/button/image_button.h" |
| 24 #include "views/controls/button/menu_button.h" | 24 #include "views/controls/button/menu_button.h" |
| 25 #include "views/controls/menu/menu_item_view.h" | 25 #include "views/controls/menu/menu_item_view.h" |
| 26 #include "views/controls/menu/submenu_view.h" | 26 #include "views/controls/menu/submenu_view.h" |
| 27 #include "views/widget/widget.h" | 27 #include "views/widget/widget.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const int kCellWidth = 38; | 31 const int kCellWidth = 32; |
| 32 const int kCellHeight = 31; | 32 const int kCellHeight = 32; |
| 33 const int kCellPaddingX = 5; | 33 const int kCellPaddingX = 5; |
| 34 const int kCellPaddingY = 5; | 34 const int kCellPaddingY = 5; |
| 35 const int kGridMaxCol = 3; | 35 const int kGridMaxCol = 3; |
| 36 | 36 |
| 37 static inline int Round(double x) { | 37 static inline int Round(double x) { |
| 38 return static_cast<int>(x + 0.5); | 38 return static_cast<int>(x + 0.5); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // This is an button that scales its image to fit its bounds. | 41 // This is an button that scales its image to fit its bounds. |
| 42 class ScaledImageButton : public views::ImageButton { | 42 class ScaledImageButton : public views::ImageButton { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // deleted while we're running we won't prematurely delete the menu. | 190 // deleted while we're running we won't prematurely delete the menu. |
| 191 // TODO(sky): fix this, the menu should really take ownership of the menu | 191 // TODO(sky): fix this, the menu should really take ownership of the menu |
| 192 // (57890). | 192 // (57890). |
| 193 scoped_refptr<AvatarMenu> dont_delete_while_running(this); | 193 scoped_refptr<AvatarMenu> dont_delete_while_running(this); |
| 194 gfx::Point screen_loc; | 194 gfx::Point screen_loc; |
| 195 views::View::ConvertPointToScreen(host, &screen_loc); | 195 views::View::ConvertPointToScreen(host, &screen_loc); |
| 196 gfx::Rect bounds(screen_loc, host->size()); | 196 gfx::Rect bounds(screen_loc, host->size()); |
| 197 root_->RunMenuAt(host->GetWidget(), host, bounds, | 197 root_->RunMenuAt(host->GetWidget(), host, bounds, |
| 198 views::MenuItemView::TOPLEFT, true); | 198 views::MenuItemView::TOPLEFT, true); |
| 199 } | 199 } |
| OLD | NEW |