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

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

Issue 9416070: Move creation and ownership of HostZoomMap to content instead of having every embedder do this. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac/cros browsertests Created 8 years, 10 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/toolbar/wrench_menu_model.cc ('k') | chrome/test/base/testing_profile.h » ('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
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 14 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" 18 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
19 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "content/public/browser/host_zoom_map.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
23 #include "content/public/browser/notification_types.h" 24 #include "content/public/browser/notification_types.h"
24 #include "content/public/browser/user_metrics.h" 25 #include "content/public/browser/user_metrics.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
27 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
28 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
29 #include "third_party/skia/include/core/SkPaint.h" 30 #include "third_party/skia/include/core/SkPaint.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 fullscreen_button_->SetAccessibleName( 441 fullscreen_button_->SetAccessibleName(
441 GetAccessibleNameForWrenchMenuItem( 442 GetAccessibleNameForWrenchMenuItem(
442 menu_model, fullscreen_index, IDS_ACCNAME_FULLSCREEN)); 443 menu_model, fullscreen_index, IDS_ACCNAME_FULLSCREEN));
443 AddChildView(fullscreen_button_); 444 AddChildView(fullscreen_button_);
444 445
445 UpdateZoomControls(); 446 UpdateZoomControls();
446 447
447 registrar_.Add( 448 registrar_.Add(
448 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 449 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
449 content::Source<HostZoomMap>( 450 content::Source<HostZoomMap>(
450 menu->browser_->profile()->GetHostZoomMap())); 451 HostZoomMap::GetForBrowserContext(menu->browser_->profile())));
451 } 452 }
452 453
453 gfx::Size GetPreferredSize() { 454 gfx::Size GetPreferredSize() {
454 // The increment/decrement button are forced to the same width. 455 // The increment/decrement button are forced to the same width.
455 int button_width = std::max(increment_button_->GetPreferredSize().width(), 456 int button_width = std::max(increment_button_->GetPreferredSize().width(),
456 decrement_button_->GetPreferredSize().width()); 457 decrement_button_->GetPreferredSize().width());
457 int fullscreen_width = fullscreen_button_->GetPreferredSize().width(); 458 int fullscreen_width = fullscreen_button_->GetPreferredSize().width();
458 // Returned height doesn't matter as MenuItemView forces everything to the 459 // Returned height doesn't matter as MenuItemView forces everything to the
459 // height of the menuitemview. 460 // height of the menuitemview.
460 return gfx::Size(button_width + zoom_label_width_ + button_width + 461 return gfx::Size(button_width + zoom_label_width_ + button_width +
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 bookmark_menu_delegate_.reset( 895 bookmark_menu_delegate_.reset(
895 new BookmarkMenuDelegate(browser_->profile(), 896 new BookmarkMenuDelegate(browser_->profile(),
896 NULL, 897 NULL,
897 parent, 898 parent,
898 first_bookmark_command_id_)); 899 first_bookmark_command_id_));
899 bookmark_menu_delegate_->Init( 900 bookmark_menu_delegate_->Init(
900 this, bookmark_menu_, model->bookmark_bar_node(), 0, 901 this, bookmark_menu_, model->bookmark_bar_node(), 0,
901 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 902 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
902 bookmark_utils::LAUNCH_WRENCH_MENU); 903 bookmark_utils::LAUNCH_WRENCH_MENU);
903 } 904 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698