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

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

Issue 7349021: Convert some more view methods to the ui/views style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
OLDNEW
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/wrench_menu.h" 5 #include "chrome/browser/ui/views/wrench_menu.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 gfx::Size GetPreferredSize() { 344 gfx::Size GetPreferredSize() {
345 // Returned height doesn't matter as MenuItemView forces everything to the 345 // Returned height doesn't matter as MenuItemView forces everything to the
346 // height of the menuitemview. 346 // height of the menuitemview.
347 return gfx::Size(GetMaxChildViewPreferredWidth() * child_count(), 0); 347 return gfx::Size(GetMaxChildViewPreferredWidth() * child_count(), 0);
348 } 348 }
349 349
350 void Layout() { 350 void Layout() {
351 // All buttons are given the same width. 351 // All buttons are given the same width.
352 int width = GetMaxChildViewPreferredWidth(); 352 int width = GetMaxChildViewPreferredWidth();
353 for (int i = 0; i < child_count(); ++i) 353 for (int i = 0; i < child_count(); ++i)
354 GetChildViewAt(i)->SetBounds(i * width, 0, width, height()); 354 child_at(i)->SetBounds(i * width, 0, width, height());
355 } 355 }
356 356
357 // ButtonListener 357 // ButtonListener
358 virtual void ButtonPressed(views::Button* sender, const views::Event& event) { 358 virtual void ButtonPressed(views::Button* sender, const views::Event& event) {
359 menu_->CancelAndEvaluate(menu_model_, sender->tag()); 359 menu_->CancelAndEvaluate(menu_model_, sender->tag());
360 } 360 }
361 361
362 private: 362 private:
363 // Returns the max preferred width of all the children. 363 // Returns the max preferred width of all the children.
364 int GetMaxChildViewPreferredWidth() { 364 int GetMaxChildViewPreferredWidth() {
365 int width = 0; 365 int width = 0;
366 for (int i = 0; i < child_count(); ++i) 366 for (int i = 0; i < child_count(); ++i)
367 width = std::max(width, GetChildViewAt(i)->GetPreferredSize().width()); 367 width = std::max(width, child_at(i)->GetPreferredSize().width());
368 return width; 368 return width;
369 } 369 }
370 370
371 DISALLOW_COPY_AND_ASSIGN(CutCopyPasteView); 371 DISALLOW_COPY_AND_ASSIGN(CutCopyPasteView);
372 }; 372 };
373 373
374 // ZoomView -------------------------------------------------------------------- 374 // ZoomView --------------------------------------------------------------------
375 375
376 // Padding between the increment buttons and the reset button. 376 // Padding between the increment buttons and the reset button.
377 static const int kZoomPadding = 6; 377 static const int kZoomPadding = 6;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 model->AddObserver(this); 855 model->AddObserver(this);
856 bookmark_menu_delegate_.reset( 856 bookmark_menu_delegate_.reset(
857 new BookmarkMenuDelegate(browser_->profile(), 857 new BookmarkMenuDelegate(browser_->profile(),
858 NULL, 858 NULL,
859 browser_->window()->GetNativeHandle(), 859 browser_->window()->GetNativeHandle(),
860 first_bookmark_command_id_)); 860 first_bookmark_command_id_));
861 bookmark_menu_delegate_->Init( 861 bookmark_menu_delegate_->Init(
862 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, 862 this, bookmark_menu_, model->GetBookmarkBarNode(), 0,
863 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); 863 BookmarkMenuDelegate::SHOW_OTHER_FOLDER);
864 } 864 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | chrome/test/interactive_ui/view_event_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698