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

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

Issue 10823025: Adding new maximize menu according to spec (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: git try 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
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | 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_delegate.h" 5 #include "ui/views/bubble/bubble_delegate.h"
6 6
7 #include "ui/base/animation/slide_animation.h" 7 #include "ui/base/animation/slide_animation.h"
8 #include "ui/gfx/color_utils.h" 8 #include "ui/gfx/color_utils.h"
9 #include "ui/views/bubble/bubble_frame_view.h" 9 #include "ui/views/bubble/bubble_frame_view.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 close_on_deactivate_(true), 108 close_on_deactivate_(true),
109 anchor_view_(NULL), 109 anchor_view_(NULL),
110 anchor_widget_(NULL), 110 anchor_widget_(NULL),
111 move_with_anchor_(false), 111 move_with_anchor_(false),
112 arrow_location_(BubbleBorder::TOP_LEFT), 112 arrow_location_(BubbleBorder::TOP_LEFT),
113 color_(kBackgroundColor), 113 color_(kBackgroundColor),
114 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), 114 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin),
115 original_opacity_(255), 115 original_opacity_(255),
116 border_widget_(NULL), 116 border_widget_(NULL),
117 use_focusless_(false), 117 use_focusless_(false),
118 try_mirroring_arrow_(true),
118 parent_window_(NULL) { 119 parent_window_(NULL) {
119 set_background(Background::CreateSolidBackground(color_)); 120 set_background(Background::CreateSolidBackground(color_));
120 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 121 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
121 } 122 }
122 123
123 BubbleDelegateView::BubbleDelegateView( 124 BubbleDelegateView::BubbleDelegateView(
124 View* anchor_view, 125 View* anchor_view,
125 BubbleBorder::ArrowLocation arrow_location) 126 BubbleBorder::ArrowLocation arrow_location)
126 : close_on_esc_(true), 127 : close_on_esc_(true),
127 close_on_deactivate_(true), 128 close_on_deactivate_(true),
128 anchor_view_(anchor_view), 129 anchor_view_(anchor_view),
129 anchor_widget_(NULL), 130 anchor_widget_(NULL),
130 move_with_anchor_(false), 131 move_with_anchor_(false),
131 arrow_location_(arrow_location), 132 arrow_location_(arrow_location),
132 color_(kBackgroundColor), 133 color_(kBackgroundColor),
133 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), 134 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin),
134 original_opacity_(255), 135 original_opacity_(255),
135 border_widget_(NULL), 136 border_widget_(NULL),
136 use_focusless_(false), 137 use_focusless_(false),
138 try_mirroring_arrow_(true),
137 parent_window_(NULL) { 139 parent_window_(NULL) {
138 set_background(Background::CreateSolidBackground(color_)); 140 set_background(Background::CreateSolidBackground(color_));
139 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 141 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
140 } 142 }
141 143
142 BubbleDelegateView::~BubbleDelegateView() { 144 BubbleDelegateView::~BubbleDelegateView() {
143 if (anchor_widget() != NULL) 145 if (anchor_widget() != NULL)
144 anchor_widget()->RemoveObserver(this); 146 anchor_widget()->RemoveObserver(this);
145 anchor_widget_ = NULL; 147 anchor_widget_ = NULL;
146 anchor_view_ = NULL; 148 anchor_view_ = NULL;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const { 327 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const {
326 const Widget* widget = border_widget_ ? border_widget_ : GetWidget(); 328 const Widget* widget = border_widget_ ? border_widget_ : GetWidget();
327 const NonClientView* view = widget ? widget->non_client_view() : NULL; 329 const NonClientView* view = widget ? widget->non_client_view() : NULL;
328 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; 330 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL;
329 } 331 }
330 332
331 gfx::Rect BubbleDelegateView::GetBubbleBounds() { 333 gfx::Rect BubbleDelegateView::GetBubbleBounds() {
332 // The argument rect has its origin at the bubble's arrow anchor point; 334 // The argument rect has its origin at the bubble's arrow anchor point;
333 // its size is the preferred size of the bubble's client view (this view). 335 // its size is the preferred size of the bubble's client view (this view).
334 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), 336 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(),
335 GetPreferredSize(), true /*try_mirroring_arrow*/); 337 GetPreferredSize(), try_mirroring_arrow_);
336 } 338 }
337 339
338 #if defined(OS_WIN) && !defined(USE_AURA) 340 #if defined(OS_WIN) && !defined(USE_AURA)
339 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { 341 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
340 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); 342 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
341 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); 343 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin());
342 return client_bounds; 344 return client_bounds;
343 } 345 }
344 #endif 346 #endif
345 347
346 } // namespace views 348 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698