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

Side by Side Diff: chrome/browser/ui/views/location_bar/zoom_bubble_view.cc

Issue 10830366: Avoid overriding Bubble's GetAnchorRect() where possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove a redundant DCHECK. 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
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/location_bar/zoom_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
6 6
7 #include "chrome/browser/chrome_page_zoom.h" 7 #include "chrome/browser/chrome_page_zoom.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents.h"
9 #include "chrome/browser/ui/zoom/zoom_controller.h" 9 #include "chrome/browser/ui/zoom/zoom_controller.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return zoom_bubble_ != NULL; 67 return zoom_bubble_ != NULL;
68 } 68 }
69 69
70 ZoomBubbleView::ZoomBubbleView(views::View* anchor_view, 70 ZoomBubbleView::ZoomBubbleView(views::View* anchor_view,
71 TabContents* tab_contents, 71 TabContents* tab_contents,
72 bool auto_close) 72 bool auto_close)
73 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 73 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
74 label_(NULL), 74 label_(NULL),
75 tab_contents_(tab_contents), 75 tab_contents_(tab_contents),
76 auto_close_(auto_close) { 76 auto_close_(auto_close) {
77 // Compensate for built-in vertical padding in the anchor view's image.
78 set_anchor_insets(gfx::Insets(5, 0, 5, 0));
77 set_use_focusless(auto_close); 79 set_use_focusless(auto_close);
78 set_notify_enter_exit_on_child(true); 80 set_notify_enter_exit_on_child(true);
79 } 81 }
80 82
81 ZoomBubbleView::~ZoomBubbleView() { 83 ZoomBubbleView::~ZoomBubbleView() {
82 } 84 }
83 85
84 void ZoomBubbleView::Refresh() { 86 void ZoomBubbleView::Refresh() {
85 int zoom_percent = tab_contents_->zoom_controller()->zoom_percent(); 87 int zoom_percent = tab_contents_->zoom_controller()->zoom_percent();
86 label_->SetText( 88 label_->SetText(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 AddChildView(new views::Separator()); 142 AddChildView(new views::Separator());
141 143
142 views::TextButton* set_default_button = new views::TextButton( 144 views::TextButton* set_default_button = new views::TextButton(
143 this, l10n_util::GetStringUTF16(IDS_ZOOM_SET_DEFAULT)); 145 this, l10n_util::GetStringUTF16(IDS_ZOOM_SET_DEFAULT));
144 set_default_button->set_alignment(views::TextButtonBase::ALIGN_CENTER); 146 set_default_button->set_alignment(views::TextButtonBase::ALIGN_CENTER);
145 AddChildView(set_default_button); 147 AddChildView(set_default_button);
146 148
147 StartTimerIfNecessary(); 149 StartTimerIfNecessary();
148 } 150 }
149 151
150 gfx::Rect ZoomBubbleView::GetAnchorRect() {
151 // Compensate for some built-in padding in the zoom image.
152 gfx::Rect rect(BubbleDelegateView::GetAnchorRect());
153 rect.Inset(0, anchor_view() ? 5 : 0);
154 return rect;
155 }
156
157 void ZoomBubbleView::WindowClosing() { 152 void ZoomBubbleView::WindowClosing() {
158 DCHECK(zoom_bubble_ == this); 153 DCHECK(zoom_bubble_ == this);
159 zoom_bubble_ = NULL; 154 zoom_bubble_ = NULL;
160 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/zoom_bubble_view.h ('k') | chrome/browser/ui/views/network_profile_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698