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

Side by Side Diff: ui/views/bubble/bubble_frame_view.cc

Issue 11756005: Implement rough new dialog style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 11 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 | « ui/native_theme/native_theme_win.cc ('k') | ui/views/controls/button/label_button.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 "ui/views/bubble/bubble_frame_view.h" 5 #include "ui/views/bubble/bubble_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/gfx/screen.h" 9 #include "ui/gfx/screen.h"
10 #include "ui/views/bubble/bubble_border.h" 10 #include "ui/views/bubble/bubble_border.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 BubbleFrameView::BubbleFrameView(const gfx::Insets& margins, 42 BubbleFrameView::BubbleFrameView(const gfx::Insets& margins,
43 BubbleBorder* border) 43 BubbleBorder* border)
44 : bubble_border_(border), 44 : bubble_border_(border),
45 content_margins_(margins) { 45 content_margins_(margins) {
46 set_border(bubble_border_); 46 set_border(bubble_border_);
47 } 47 }
48 48
49 BubbleFrameView::~BubbleFrameView() {} 49 BubbleFrameView::~BubbleFrameView() {}
50 50
51 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { 51 gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
52 gfx::Insets margin = bubble_border()->GetInsets(); 52 gfx::Rect client_bounds = GetLocalBounds();
53 margin += content_margins(); 53 client_bounds.Inset(border()->GetInsets());
54 return gfx::Rect(margin.left(), margin.top(), 54 client_bounds.Inset(content_margins());
55 std::max(width() - margin.width(), 0), 55 return client_bounds;
56 std::max(height() - margin.height(), 0));
57 } 56 }
58 57
59 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( 58 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds(
60 const gfx::Rect& client_bounds) const { 59 const gfx::Rect& client_bounds) const {
61 return const_cast<BubbleFrameView*>(this)->GetUpdatedWindowBounds( 60 return const_cast<BubbleFrameView*>(this)->GetUpdatedWindowBounds(
62 gfx::Rect(), client_bounds.size(), false); 61 gfx::Rect(), client_bounds.size(), false);
63 } 62 }
64 63
65 int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { 64 int BubbleFrameView::NonClientHitTest(const gfx::Point& point) {
66 return GetWidget()->client_view()->NonClientHitTest(point); 65 return GetWidget()->client_view()->NonClientHitTest(point);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble 161 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble
163 // window needs to be moved to the right and that means we need to move arrow 162 // window needs to be moved to the right and that means we need to move arrow
164 // to the left, and that means negative offset. 163 // to the left, and that means negative offset.
165 bubble_border_->set_arrow_offset( 164 bubble_border_->set_arrow_offset(
166 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); 165 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust);
167 if (offscreen_adjust) 166 if (offscreen_adjust)
168 SchedulePaint(); 167 SchedulePaint();
169 } 168 }
170 169
171 } // namespace views 170 } // namespace views
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_win.cc ('k') | ui/views/controls/button/label_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698