| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wrench_menu.h" | 5 #include "chrome/browser/views/wrench_menu.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const SkColor kHotBackgroundColor = SkColorSetARGB(204, 255, 255, 255); | 53 const SkColor kHotBackgroundColor = SkColorSetARGB(204, 255, 255, 255); |
| 54 const SkColor kBackgroundColor = SkColorSetARGB(102, 255, 255, 255); | 54 const SkColor kBackgroundColor = SkColorSetARGB(102, 255, 255, 255); |
| 55 const SkColor kPushedBackgroundColor = SkColorSetARGB(13, 0, 0, 0); | 55 const SkColor kPushedBackgroundColor = SkColorSetARGB(13, 0, 0, 0); |
| 56 | 56 |
| 57 // Horizontal padding on the edges of the buttons. | 57 // Horizontal padding on the edges of the buttons. |
| 58 const int kHorizontalPadding = 6; | 58 const int kHorizontalPadding = 6; |
| 59 | 59 |
| 60 // Subclass of ImageButton whose preferred size includes the size of the border. | 60 // Subclass of ImageButton whose preferred size includes the size of the border. |
| 61 class FullscreenButton : public ImageButton { | 61 class FullscreenButton : public ImageButton { |
| 62 public: | 62 public: |
| 63 FullscreenButton(views::ButtonListener* listener) : ImageButton(listener) {} | 63 explicit FullscreenButton(views::ButtonListener* listener) |
| 64 : ImageButton(listener) { } |
| 64 | 65 |
| 65 virtual gfx::Size GetPreferredSize() { | 66 virtual gfx::Size GetPreferredSize() { |
| 66 gfx::Size pref = ImageButton::GetPreferredSize(); | 67 gfx::Size pref = ImageButton::GetPreferredSize(); |
| 67 gfx::Insets insets; | 68 gfx::Insets insets; |
| 68 if (border()) | 69 if (border()) |
| 69 border()->GetInsets(&insets); | 70 border()->GetInsets(&insets); |
| 70 pref.Enlarge(insets.width(), insets.height()); | 71 pref.Enlarge(insets.width(), insets.height()); |
| 71 return pref; | 72 return pref; |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 button->set_tag(index); | 252 button->set_tag(index); |
| 252 button->SetEnabled(model->IsEnabledAt(index)); | 253 button->SetEnabled(model->IsEnabledAt(index)); |
| 253 button->set_prefix_type(TextButton::PREFIX_HIDE); | 254 button->set_prefix_type(TextButton::PREFIX_HIDE); |
| 254 MenuButtonBackground* bg = new MenuButtonBackground(type); | 255 MenuButtonBackground* bg = new MenuButtonBackground(type); |
| 255 button->set_background(bg); | 256 button->set_background(bg); |
| 256 button->SetEnabledColor(MenuConfig::instance().text_color); | 257 button->SetEnabledColor(MenuConfig::instance().text_color); |
| 257 if (background) | 258 if (background) |
| 258 *background = bg; | 259 *background = bg; |
| 259 button->set_border(new MenuButtonBorder()); | 260 button->set_border(new MenuButtonBorder()); |
| 260 button->set_alignment(TextButton::ALIGN_CENTER); | 261 button->set_alignment(TextButton::ALIGN_CENTER); |
| 261 button->SetShowHighlighted(true); | |
| 262 button->SetNormalHasBorder(true); | 262 button->SetNormalHasBorder(true); |
| 263 button->SetFont(views::MenuConfig::instance().font); | 263 button->SetFont(views::MenuConfig::instance().font); |
| 264 button->ClearMaxTextSize(); | 264 button->ClearMaxTextSize(); |
| 265 parent->AddChildView(button); | 265 parent->AddChildView(button); |
| 266 return button; | 266 return button; |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace | 269 } // namespace |
| 270 | 270 |
| 271 // CutCopyPasteView ------------------------------------------------------------ | 271 // CutCopyPasteView ------------------------------------------------------------ |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } | 699 } |
| 700 | 700 |
| 701 return menu_item; | 701 return menu_item; |
| 702 } | 702 } |
| 703 | 703 |
| 704 void WrenchMenu::CancelAndEvaluate(MenuModel* model, int index) { | 704 void WrenchMenu::CancelAndEvaluate(MenuModel* model, int index) { |
| 705 selected_menu_model_ = model; | 705 selected_menu_model_ = model; |
| 706 selected_index_ = index; | 706 selected_index_ = index; |
| 707 root_->Cancel(); | 707 root_->Cancel(); |
| 708 } | 708 } |
| OLD | NEW |