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

Side by Side Diff: ash/wm/caption_buttons/maximize_bubble_controller_bubble.cc

Issue 82483003: Add GetMinimumSize() for Borders, and make LabelButton auto-size to at least as (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 | « ash/system/tray/tray_details_view.cc ('k') | chrome/browser/ui/views/avatar_label.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/wm/caption_buttons/maximize_bubble_controller_bubble.h" 5 #include "ash/wm/caption_buttons/maximize_bubble_controller_bubble.h"
6 6
7 #include "ash/shell_delegate.h" 7 #include "ash/shell_delegate.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/caption_buttons/bubble_contents_button_row.h" 9 #include "ash/wm/caption_buttons/bubble_contents_button_row.h"
10 #include "ash/wm/caption_buttons/frame_maximize_button.h" 10 #include "ash/wm/caption_buttons/frame_maximize_button.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 virtual ~MaximizeBubbleBorder() {} 141 virtual ~MaximizeBubbleBorder() {}
142 142
143 // Get the mouse active area of the window. 143 // Get the mouse active area of the window.
144 void GetMask(gfx::Path* mask); 144 void GetMask(gfx::Path* mask);
145 145
146 // views::BubbleBorder: 146 // views::BubbleBorder:
147 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, 147 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
148 const gfx::Size& contents_size) const OVERRIDE; 148 const gfx::Size& contents_size) const OVERRIDE;
149 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; 149 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE;
150 virtual gfx::Size GetMinimumSize() const OVERRIDE;
150 151
151 private: 152 private:
152 // Note: Animations can continue after then main window frame was destroyed. 153 // Note: Animations can continue after then main window frame was destroyed.
153 // To avoid this problem, the owning screen metrics get extracted upon 154 // To avoid this problem, the owning screen metrics get extracted upon
154 // creation. 155 // creation.
155 gfx::Size anchor_size_; 156 gfx::Size anchor_size_;
156 gfx::Point anchor_screen_origin_; 157 gfx::Point anchor_screen_origin_;
157 views::View* content_view_; 158 views::View* content_view_;
158 159
159 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleBorder); 160 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleBorder);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); 249 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y));
249 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth), 250 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth),
250 SkIntToScalar(left_base_y)); 251 SkIntToScalar(left_base_y));
251 252
252 SkPaint paint; 253 SkPaint paint;
253 paint.setStyle(SkPaint::kFill_Style); 254 paint.setStyle(SkPaint::kFill_Style);
254 paint.setColor(MaximizeBubbleControllerBubble::kBubbleBackgroundColor); 255 paint.setColor(MaximizeBubbleControllerBubble::kBubbleBackgroundColor);
255 canvas->DrawPath(path, paint); 256 canvas->DrawPath(path, paint);
256 } 257 }
257 258
259 gfx::Size MaximizeBubbleBorder::GetMinimumSize() const {
260 return gfx::Size(kLineWidth * 2 + kArrowWidth,
261 std::max(kLineWidth, kArrowHeight) + kLineWidth);
262 }
263
258 264
259 // BubbleMouseWatcherHost ----------------------------------------------------- 265 // BubbleMouseWatcherHost -----------------------------------------------------
260 266
261 // The mouse watcher host which makes sure that the bubble does not get closed 267 // The mouse watcher host which makes sure that the bubble does not get closed
262 // while the mouse cursor is over the maximize button or the balloon content. 268 // while the mouse cursor is over the maximize button or the balloon content.
263 // Note: This object gets destroyed when the MouseWatcher gets destroyed. 269 // Note: This object gets destroyed when the MouseWatcher gets destroyed.
264 class BubbleMouseWatcherHost: public views::MouseWatcherHost { 270 class BubbleMouseWatcherHost: public views::MouseWatcherHost {
265 public: 271 public:
266 explicit BubbleMouseWatcherHost(MaximizeBubbleControllerBubble* bubble); 272 explicit BubbleMouseWatcherHost(MaximizeBubbleControllerBubble* bubble);
267 virtual ~BubbleMouseWatcherHost(); 273 virtual ~BubbleMouseWatcherHost();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (contents_view_) 488 if (contents_view_)
483 contents_view_->SetSnapType(snap_type); 489 contents_view_->SetSnapType(snap_type);
484 } 490 }
485 491
486 views::CustomButton* MaximizeBubbleControllerBubble::GetButtonForUnitTest( 492 views::CustomButton* MaximizeBubbleControllerBubble::GetButtonForUnitTest(
487 SnapType state) { 493 SnapType state) {
488 return contents_view_->GetButtonForUnitTest(state); 494 return contents_view_->GetButtonForUnitTest(state);
489 } 495 }
490 496
491 } // namespace ash 497 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_details_view.cc ('k') | chrome/browser/ui/views/avatar_label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698