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

Side by Side Diff: ash/frame/custom_frame_view_ash.cc

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 "ash/frame/custom_frame_view_ash.h" 5 #include "ash/frame/custom_frame_view_ash.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
9 #include "ash/frame/caption_buttons/frame_maximize_button.h" 9 #include "ash/frame/caption_buttons/frame_maximize_button.h"
10 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h" 10 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // View which takes up the entire widget and contains the HeaderView. HeaderView 384 // View which takes up the entire widget and contains the HeaderView. HeaderView
385 // is a child of OverlayView to avoid creating a larger texture than necessary 385 // is a child of OverlayView to avoid creating a larger texture than necessary
386 // when painting the HeaderView to its own layer. 386 // when painting the HeaderView to its own layer.
387 class CustomFrameViewAsh::OverlayView : public views::View { 387 class CustomFrameViewAsh::OverlayView : public views::View {
388 public: 388 public:
389 explicit OverlayView(HeaderView* header_view); 389 explicit OverlayView(HeaderView* header_view);
390 virtual ~OverlayView(); 390 virtual ~OverlayView();
391 391
392 // views::View override: 392 // views::View override:
393 virtual void Layout() OVERRIDE; 393 virtual void Layout() OVERRIDE;
394 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; 394 virtual bool HitTestRect(const gfx::RectF& rect) const OVERRIDE;
395 395
396 private: 396 private:
397 HeaderView* header_view_; 397 HeaderView* header_view_;
398 398
399 DISALLOW_COPY_AND_ASSIGN(OverlayView); 399 DISALLOW_COPY_AND_ASSIGN(OverlayView);
400 }; 400 };
401 401
402 CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view) 402 CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view)
403 : header_view_(header_view) { 403 : header_view_(header_view) {
404 AddChildView(header_view); 404 AddChildView(header_view);
(...skipping 13 matching lines...) Expand all
418 int onscreen_height = header_view_->GetPreferredOnScreenHeight(); 418 int onscreen_height = header_view_->GetPreferredOnScreenHeight();
419 if (onscreen_height == 0) { 419 if (onscreen_height == 0) {
420 header_view_->SetVisible(false); 420 header_view_->SetVisible(false);
421 } else { 421 } else {
422 int height = header_view_->GetPreferredHeight(); 422 int height = header_view_->GetPreferredHeight();
423 header_view_->SetBounds(0, onscreen_height - height, width(), height); 423 header_view_->SetBounds(0, onscreen_height - height, width(), height);
424 header_view_->SetVisible(true); 424 header_view_->SetVisible(true);
425 } 425 }
426 } 426 }
427 427
428 bool CustomFrameViewAsh::OverlayView::HitTestRect(const gfx::Rect& rect) const { 428 bool CustomFrameViewAsh::OverlayView::HitTestRect(
429 const gfx::RectF& rect) const {
429 // Grab events in the header view. Return false for other events so that they 430 // Grab events in the header view. Return false for other events so that they
430 // can be handled by the client view. 431 // can be handled by the client view.
431 return header_view_->HitTestRect(rect); 432 return header_view_->HitTestRect(rect);
432 } 433 }
433 434
434 //////////////////////////////////////////////////////////////////////////////// 435 ////////////////////////////////////////////////////////////////////////////////
435 // CustomFrameViewAsh, public: 436 // CustomFrameViewAsh, public:
436 437
437 // static 438 // static
438 const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh"; 439 const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh";
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint 542 // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint
542 // to HeaderView instead. 543 // to HeaderView instead.
543 gfx::RectF to_paint(r); 544 gfx::RectF to_paint(r);
544 views::View::ConvertRectToTarget(this, header_view_, &to_paint); 545 views::View::ConvertRectToTarget(this, header_view_, &to_paint);
545 header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint)); 546 header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint));
546 } else { 547 } else {
547 views::NonClientFrameView::SchedulePaintInRect(r); 548 views::NonClientFrameView::SchedulePaintInRect(r);
548 } 549 }
549 } 550 }
550 551
551 bool CustomFrameViewAsh::HitTestRect(const gfx::Rect& rect) const { 552 bool CustomFrameViewAsh::HitTestRect(const gfx::RectF& rect) const {
552 // NonClientView hit tests the NonClientFrameView first instead of going in 553 // NonClientView hit tests the NonClientFrameView first instead of going in
553 // z-order. Return false so that events get to the OverlayView. 554 // z-order. Return false so that events get to the OverlayView.
554 return false; 555 return false;
555 } 556 }
556 557
557 void CustomFrameViewAsh::VisibilityChanged(views::View* starting_from, 558 void CustomFrameViewAsh::VisibilityChanged(views::View* starting_from,
558 bool is_visible) { 559 bool is_visible) {
559 if (is_visible) 560 if (is_visible)
560 header_view_->UpdateAvatarIcon(); 561 header_view_->UpdateAvatarIcon();
561 } 562 }
(...skipping 12 matching lines...) Expand all
574 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 575 FrameCaptionButtonContainerView* CustomFrameViewAsh::
575 GetFrameCaptionButtonContainerViewForTest() { 576 GetFrameCaptionButtonContainerViewForTest() {
576 return header_view_->caption_button_container(); 577 return header_view_->caption_button_container();
577 } 578 }
578 579
579 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 580 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
580 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 581 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
581 } 582 }
582 583
583 } // namespace ash 584 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698