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

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

Issue 10827271: Replace views::Event with ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.h ('k') | content/shell/shell_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wrench_menu.h" 5 #include "chrome/browser/ui/views/wrench_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 10
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 virtual void Layout() OVERRIDE { 480 virtual void Layout() OVERRIDE {
481 // All buttons are given the same width. 481 // All buttons are given the same width.
482 int width = GetMaxChildViewPreferredWidth(); 482 int width = GetMaxChildViewPreferredWidth();
483 for (int i = 0; i < child_count(); ++i) 483 for (int i = 0; i < child_count(); ++i)
484 child_at(i)->SetBounds(i * width, 0, width, height()); 484 child_at(i)->SetBounds(i * width, 0, width, height());
485 } 485 }
486 486
487 // Overridden from ButtonListener. 487 // Overridden from ButtonListener.
488 virtual void ButtonPressed(views::Button* sender, 488 virtual void ButtonPressed(views::Button* sender,
489 const views::Event& event) OVERRIDE { 489 const ui::Event& event) OVERRIDE {
490 menu_->CancelAndEvaluate(menu_model_, sender->tag()); 490 menu_->CancelAndEvaluate(menu_model_, sender->tag());
491 } 491 }
492 492
493 private: 493 private:
494 // Returns the max preferred width of all the children. 494 // Returns the max preferred width of all the children.
495 int GetMaxChildViewPreferredWidth() { 495 int GetMaxChildViewPreferredWidth() {
496 int width = 0; 496 int width = 0;
497 for (int i = 0; i < child_count(); ++i) 497 for (int i = 0; i < child_count(); ++i)
498 width = std::max(width, child_at(i)->GetPreferredSize().width()); 498 width = std::max(width, child_at(i)->GetPreferredSize().width());
499 return width; 499 return width;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 bool is_touch = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH; 639 bool is_touch = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH;
640 x += bounds.width() + (is_touch ? 0 : kZoomPadding); 640 x += bounds.width() + (is_touch ? 0 : kZoomPadding);
641 bounds.set_x(x); 641 bounds.set_x(x);
642 bounds.set_width(fullscreen_button_->GetPreferredSize().width() + 642 bounds.set_width(fullscreen_button_->GetPreferredSize().width() +
643 (is_touch ? kTouchZoomPadding : 0)); 643 (is_touch ? kTouchZoomPadding : 0));
644 fullscreen_button_->SetBoundsRect(bounds); 644 fullscreen_button_->SetBoundsRect(bounds);
645 } 645 }
646 646
647 // Overridden from ButtonListener. 647 // Overridden from ButtonListener.
648 virtual void ButtonPressed(views::Button* sender, 648 virtual void ButtonPressed(views::Button* sender,
649 const views::Event& event) OVERRIDE { 649 const ui::Event& event) OVERRIDE {
650 if (sender->tag() == fullscreen_index_) { 650 if (sender->tag() == fullscreen_index_) {
651 menu_->CancelAndEvaluate(menu_model_, sender->tag()); 651 menu_->CancelAndEvaluate(menu_model_, sender->tag());
652 } else { 652 } else {
653 // Zoom buttons don't close the menu. 653 // Zoom buttons don't close the menu.
654 menu_model_->ActivatedAt(sender->tag()); 654 menu_model_->ActivatedAt(sender->tag());
655 } 655 }
656 } 656 }
657 657
658 // Overridden from content::NotificationObserver. 658 // Overridden from content::NotificationObserver.
659 virtual void Observe(int type, 659 virtual void Observe(int type,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 selected_menu_model_->ActivatedAt(selected_index_); 796 selected_menu_model_->ActivatedAt(selected_index_);
797 } 797 }
798 798
799 string16 WrenchMenu::GetTooltipText(int id, 799 string16 WrenchMenu::GetTooltipText(int id,
800 const gfx::Point& p) const { 800 const gfx::Point& p) const {
801 return is_bookmark_command(id) ? 801 return is_bookmark_command(id) ?
802 bookmark_menu_delegate_->GetTooltipText(id, p) : string16(); 802 bookmark_menu_delegate_->GetTooltipText(id, p) : string16();
803 } 803 }
804 804
805 bool WrenchMenu::IsTriggerableEvent(views::MenuItemView* menu, 805 bool WrenchMenu::IsTriggerableEvent(views::MenuItemView* menu,
806 const views::Event& e) { 806 const ui::Event& e) {
807 return is_bookmark_command(menu->GetCommand()) ? 807 return is_bookmark_command(menu->GetCommand()) ?
808 bookmark_menu_delegate_->IsTriggerableEvent(menu, e) : 808 bookmark_menu_delegate_->IsTriggerableEvent(menu, e) :
809 MenuDelegate::IsTriggerableEvent(menu, e); 809 MenuDelegate::IsTriggerableEvent(menu, e);
810 } 810 }
811 811
812 bool WrenchMenu::GetDropFormats( 812 bool WrenchMenu::GetDropFormats(
813 MenuItemView* menu, 813 MenuItemView* menu,
814 int* formats, 814 int* formats,
815 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { 815 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) {
816 CreateBookmarkMenu(); 816 CreateBookmarkMenu();
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 bookmark_menu_delegate_.reset( 1113 bookmark_menu_delegate_.reset(
1114 new BookmarkMenuDelegate(browser_, 1114 new BookmarkMenuDelegate(browser_,
1115 browser_, 1115 browser_,
1116 parent, 1116 parent,
1117 first_bookmark_command_id_)); 1117 first_bookmark_command_id_));
1118 bookmark_menu_delegate_->Init( 1118 bookmark_menu_delegate_->Init(
1119 this, bookmark_menu_, model->bookmark_bar_node(), 0, 1119 this, bookmark_menu_, model->bookmark_bar_node(), 0,
1120 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 1120 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
1121 bookmark_utils::LAUNCH_WRENCH_MENU); 1121 bookmark_utils::LAUNCH_WRENCH_MENU);
1122 } 1122 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.h ('k') | content/shell/shell_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698