| 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/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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 0, kHorizontalPadding, 0, kHorizontalPadding)); | 431 0, kHorizontalPadding, 0, kHorizontalPadding)); |
| 432 fullscreen_button_->set_background( | 432 fullscreen_button_->set_background( |
| 433 new MenuButtonBackground(MenuButtonBackground::SINGLE_BUTTON)); | 433 new MenuButtonBackground(MenuButtonBackground::SINGLE_BUTTON)); |
| 434 fullscreen_button_->SetAccessibleName( | 434 fullscreen_button_->SetAccessibleName( |
| 435 GetAccessibleNameForWrenchMenuItem( | 435 GetAccessibleNameForWrenchMenuItem( |
| 436 menu_model, fullscreen_index, IDS_ACCNAME_FULLSCREEN)); | 436 menu_model, fullscreen_index, IDS_ACCNAME_FULLSCREEN)); |
| 437 AddChildView(fullscreen_button_); | 437 AddChildView(fullscreen_button_); |
| 438 | 438 |
| 439 UpdateZoomControls(); | 439 UpdateZoomControls(); |
| 440 | 440 |
| 441 registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED, | 441 registrar_.Add( |
| 442 Source<Profile>(menu->browser_->profile())); | 442 this, NotificationType::ZOOM_LEVEL_CHANGED, |
| 443 Source<HostZoomMap>(menu->browser_->profile()->GetHostZoomMap())); |
| 443 } | 444 } |
| 444 | 445 |
| 445 gfx::Size GetPreferredSize() { | 446 gfx::Size GetPreferredSize() { |
| 446 // The increment/decrement button are forced to the same width. | 447 // The increment/decrement button are forced to the same width. |
| 447 int button_width = std::max(increment_button_->GetPreferredSize().width(), | 448 int button_width = std::max(increment_button_->GetPreferredSize().width(), |
| 448 decrement_button_->GetPreferredSize().width()); | 449 decrement_button_->GetPreferredSize().width()); |
| 449 int fullscreen_width = fullscreen_button_->GetPreferredSize().width(); | 450 int fullscreen_width = fullscreen_button_->GetPreferredSize().width(); |
| 450 // Returned height doesn't matter as MenuItemView forces everything to the | 451 // Returned height doesn't matter as MenuItemView forces everything to the |
| 451 // height of the menuitemview. | 452 // height of the menuitemview. |
| 452 return gfx::Size(button_width + zoom_label_width_ + button_width + | 453 return gfx::Size(button_width + zoom_label_width_ + button_width + |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 model->AddObserver(this); | 855 model->AddObserver(this); |
| 855 bookmark_menu_delegate_.reset( | 856 bookmark_menu_delegate_.reset( |
| 856 new BookmarkMenuDelegate(browser_->profile(), | 857 new BookmarkMenuDelegate(browser_->profile(), |
| 857 NULL, | 858 NULL, |
| 858 browser_->window()->GetNativeHandle(), | 859 browser_->window()->GetNativeHandle(), |
| 859 first_bookmark_command_id_)); | 860 first_bookmark_command_id_)); |
| 860 bookmark_menu_delegate_->Init( | 861 bookmark_menu_delegate_->Init( |
| 861 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, | 862 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, |
| 862 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); | 863 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); |
| 863 } | 864 } |
| OLD | NEW |