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

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

Issue 21668003: Implement newly saved card bubble for realz and update generated card bubble to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 "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/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 #include "ui/native_theme/native_theme.h" 10 #include "ui/native_theme/native_theme.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; 374 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL;
375 } 375 }
376 376
377 gfx::Rect BubbleDelegateView::GetBubbleBounds() { 377 gfx::Rect BubbleDelegateView::GetBubbleBounds() {
378 // The argument rect has its origin at the bubble's arrow anchor point; 378 // The argument rect has its origin at the bubble's arrow anchor point;
379 // its size is the preferred size of the bubble's client view (this view). 379 // its size is the preferred size of the bubble's client view (this view).
380 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), 380 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(),
381 GetPreferredSize(), adjust_if_offscreen_); 381 GetPreferredSize(), adjust_if_offscreen_);
382 } 382 }
383 383
384 gfx::Size BubbleDelegateView::GetPreferredSizeForTitle() {
385 NonClientFrameView* fv = GetWidget()->non_client_view()->frame_view();
msw 2013/08/08 21:56:52 nit: use GetBubbleFrameView(), avoid acronym ident
Dan Beam 2013/08/09 01:47:58 Done.
386 int width = fv->GetBoundsForClientView().width() - GetInsets().width();
387 return gfx::Size(width, GetHeightForWidth(width));
388 }
389
384 int BubbleDelegateView::GetFadeDuration() { 390 int BubbleDelegateView::GetFadeDuration() {
385 return kHideFadeDurationMS; 391 return kHideFadeDurationMS;
386 } 392 }
387 393
388 void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) { 394 void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) {
389 if (!color_explicitly_set_) { 395 if (!color_explicitly_set_) {
390 color_ = GetNativeTheme()->GetSystemColor( 396 color_ = GetNativeTheme()->GetSystemColor(
391 ui::NativeTheme::kColorId_WindowBackground); 397 ui::NativeTheme::kColorId_WindowBackground);
392 } 398 }
393 set_background(Background::CreateSolidBackground(color())); 399 set_background(Background::CreateSolidBackground(color()));
394 BubbleFrameView* frame_view = GetBubbleFrameView(); 400 BubbleFrameView* frame_view = GetBubbleFrameView();
395 if (frame_view) 401 if (frame_view)
396 frame_view->bubble_border()->set_background_color(color()); 402 frame_view->bubble_border()->set_background_color(color());
397 } 403 }
398 404
399 #if defined(OS_WIN) && !defined(USE_AURA) 405 #if defined(OS_WIN) && !defined(USE_AURA)
400 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { 406 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
401 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); 407 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
402 client_bounds.Offset( 408 client_bounds.Offset(
403 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); 409 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin());
404 return client_bounds; 410 return client_bounds;
405 } 411 }
406 #endif 412 #endif
407 413
408 } // namespace views 414 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698