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

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: Removed radial 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
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 close_on_deactivate_(true), 107 close_on_deactivate_(true),
108 anchor_view_(NULL), 108 anchor_view_(NULL),
109 anchor_widget_(NULL), 109 anchor_widget_(NULL),
110 move_with_anchor_(false), 110 move_with_anchor_(false),
111 arrow_location_(BubbleBorder::TOP_LEFT), 111 arrow_location_(BubbleBorder::TOP_LEFT),
112 color_(kBackgroundColor), 112 color_(kBackgroundColor),
113 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), 113 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin),
114 original_opacity_(255), 114 original_opacity_(255),
115 border_widget_(NULL), 115 border_widget_(NULL),
116 use_focusless_(false), 116 use_focusless_(false),
117 try_mirroring_arrow_(true),
117 parent_window_(NULL) { 118 parent_window_(NULL) {
118 set_background(views::Background::CreateSolidBackground(color_)); 119 set_background(views::Background::CreateSolidBackground(color_));
119 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 120 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
120 } 121 }
121 122
122 BubbleDelegateView::BubbleDelegateView( 123 BubbleDelegateView::BubbleDelegateView(
123 View* anchor_view, 124 View* anchor_view,
124 BubbleBorder::ArrowLocation arrow_location) 125 BubbleBorder::ArrowLocation arrow_location)
125 : close_on_esc_(true), 126 : close_on_esc_(true),
126 close_on_deactivate_(true), 127 close_on_deactivate_(true),
127 anchor_view_(anchor_view), 128 anchor_view_(anchor_view),
128 anchor_widget_(NULL), 129 anchor_widget_(NULL),
129 move_with_anchor_(false), 130 move_with_anchor_(false),
130 arrow_location_(arrow_location), 131 arrow_location_(arrow_location),
131 color_(kBackgroundColor), 132 color_(kBackgroundColor),
132 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), 133 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin),
133 original_opacity_(255), 134 original_opacity_(255),
134 border_widget_(NULL), 135 border_widget_(NULL),
135 use_focusless_(false), 136 use_focusless_(false),
137 try_mirroring_arrow_(true),
136 parent_window_(NULL) { 138 parent_window_(NULL) {
137 set_background(views::Background::CreateSolidBackground(color_)); 139 set_background(views::Background::CreateSolidBackground(color_));
138 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 140 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
139 } 141 }
140 142
141 BubbleDelegateView::~BubbleDelegateView() { 143 BubbleDelegateView::~BubbleDelegateView() {
142 if (anchor_widget() != NULL) 144 if (anchor_widget() != NULL)
143 anchor_widget()->RemoveObserver(this); 145 anchor_widget()->RemoveObserver(this);
144 anchor_widget_ = NULL; 146 anchor_widget_ = NULL;
145 anchor_view_ = NULL; 147 anchor_view_ = NULL;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const { 317 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const {
316 const Widget* widget = border_widget_ ? border_widget_ : GetWidget(); 318 const Widget* widget = border_widget_ ? border_widget_ : GetWidget();
317 const NonClientView* view = widget ? widget->non_client_view() : NULL; 319 const NonClientView* view = widget ? widget->non_client_view() : NULL;
318 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; 320 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL;
319 } 321 }
320 322
321 gfx::Rect BubbleDelegateView::GetBubbleBounds() { 323 gfx::Rect BubbleDelegateView::GetBubbleBounds() {
322 // The argument rect has its origin at the bubble's arrow anchor point; 324 // The argument rect has its origin at the bubble's arrow anchor point;
323 // its size is the preferred size of the bubble's client view (this view). 325 // its size is the preferred size of the bubble's client view (this view).
324 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), 326 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(),
325 GetPreferredSize(), true /*try_mirroring_arrow*/); 327 GetPreferredSize(), try_mirroring_arrow_);
326 } 328 }
327 329
328 #if defined(OS_WIN) && !defined(USE_AURA) 330 #if defined(OS_WIN) && !defined(USE_AURA)
329 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { 331 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
330 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); 332 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
331 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); 333 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin());
332 return client_bounds; 334 return client_bounds;
333 } 335 }
334 #endif 336 #endif
335 337
336 } // namespace views 338 } // namespace views
OLDNEW
« ui/views/bubble/bubble_delegate.h ('K') | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698