OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 window_state_->window()->AddObserver(this); | 67 window_state_->window()->AddObserver(this); |
68 } | 68 } |
69 virtual ~CustomFrameViewAshWindowStateDelegate() { | 69 virtual ~CustomFrameViewAshWindowStateDelegate() { |
70 if (window_state_) { | 70 if (window_state_) { |
71 window_state_->RemoveObserver(this); | 71 window_state_->RemoveObserver(this); |
72 window_state_->window()->RemoveObserver(this); | 72 window_state_->window()->RemoveObserver(this); |
73 } | 73 } |
74 } | 74 } |
75 private: | 75 private: |
76 // Overridden from ash::wm::WindowStateDelegate: | 76 // Overridden from ash::wm::WindowStateDelegate: |
77 virtual bool ToggleFullscreen(ash::wm::WindowState* window_state) OVERRIDE { | 77 virtual bool ToggleFullscreen(ash::wm::WindowState* window_state) override { |
78 bool enter_fullscreen = !window_state->IsFullscreen(); | 78 bool enter_fullscreen = !window_state->IsFullscreen(); |
79 if (enter_fullscreen) { | 79 if (enter_fullscreen) { |
80 window_state->window()->SetProperty(aura::client::kShowStateKey, | 80 window_state->window()->SetProperty(aura::client::kShowStateKey, |
81 ui::SHOW_STATE_FULLSCREEN); | 81 ui::SHOW_STATE_FULLSCREEN); |
82 } else { | 82 } else { |
83 window_state->Restore(); | 83 window_state->Restore(); |
84 } | 84 } |
85 if (immersive_fullscreen_controller_) { | 85 if (immersive_fullscreen_controller_) { |
86 immersive_fullscreen_controller_->SetEnabled( | 86 immersive_fullscreen_controller_->SetEnabled( |
87 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, | 87 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, |
88 enter_fullscreen); | 88 enter_fullscreen); |
89 } | 89 } |
90 return true; | 90 return true; |
91 } | 91 } |
92 // Overridden from aura::WindowObserver: | 92 // Overridden from aura::WindowObserver: |
93 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { | 93 virtual void OnWindowDestroying(aura::Window* window) override { |
94 window_state_->RemoveObserver(this); | 94 window_state_->RemoveObserver(this); |
95 window_state_->window()->RemoveObserver(this); | 95 window_state_->window()->RemoveObserver(this); |
96 window_state_ = NULL; | 96 window_state_ = NULL; |
97 } | 97 } |
98 // Overridden from ash::wm::WindowStateObserver: | 98 // Overridden from ash::wm::WindowStateObserver: |
99 virtual void OnPostWindowStateTypeChange( | 99 virtual void OnPostWindowStateTypeChange( |
100 ash::wm::WindowState* window_state, | 100 ash::wm::WindowState* window_state, |
101 ash::wm::WindowStateType old_type) OVERRIDE { | 101 ash::wm::WindowStateType old_type) override { |
102 if (!window_state->IsFullscreen() && | 102 if (!window_state->IsFullscreen() && |
103 !window_state->IsMinimized() && | 103 !window_state->IsMinimized() && |
104 immersive_fullscreen_controller_.get() && | 104 immersive_fullscreen_controller_.get() && |
105 immersive_fullscreen_controller_->IsEnabled()) { | 105 immersive_fullscreen_controller_->IsEnabled()) { |
106 immersive_fullscreen_controller_->SetEnabled( | 106 immersive_fullscreen_controller_->SetEnabled( |
107 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, | 107 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, |
108 false); | 108 false); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 int GetPreferredHeight() const; | 147 int GetPreferredHeight() const; |
148 | 148 |
149 // Returns the view's minimum width. | 149 // Returns the view's minimum width. |
150 int GetMinimumWidth() const; | 150 int GetMinimumWidth() const; |
151 | 151 |
152 void UpdateAvatarIcon(); | 152 void UpdateAvatarIcon(); |
153 | 153 |
154 void SizeConstraintsChanged(); | 154 void SizeConstraintsChanged(); |
155 | 155 |
156 // views::View: | 156 // views::View: |
157 virtual void Layout() OVERRIDE; | 157 virtual void Layout() override; |
158 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 158 virtual void OnPaint(gfx::Canvas* canvas) override; |
159 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 159 virtual void ChildPreferredSizeChanged(views::View* child) override; |
160 | 160 |
161 // ShellObserver: | 161 // ShellObserver: |
162 virtual void OnMaximizeModeStarted() OVERRIDE; | 162 virtual void OnMaximizeModeStarted() override; |
163 virtual void OnMaximizeModeEnded() OVERRIDE; | 163 virtual void OnMaximizeModeEnded() override; |
164 | 164 |
165 FrameCaptionButtonContainerView* caption_button_container() { | 165 FrameCaptionButtonContainerView* caption_button_container() { |
166 return caption_button_container_; | 166 return caption_button_container_; |
167 } | 167 } |
168 | 168 |
169 views::View* avatar_icon() const { | 169 views::View* avatar_icon() const { |
170 return avatar_icon_; | 170 return avatar_icon_; |
171 } | 171 } |
172 | 172 |
173 private: | 173 private: |
174 // ImmersiveFullscreenController::Delegate: | 174 // ImmersiveFullscreenController::Delegate: |
175 virtual void OnImmersiveRevealStarted() OVERRIDE; | 175 virtual void OnImmersiveRevealStarted() override; |
176 virtual void OnImmersiveRevealEnded() OVERRIDE; | 176 virtual void OnImmersiveRevealEnded() override; |
177 virtual void OnImmersiveFullscreenExited() OVERRIDE; | 177 virtual void OnImmersiveFullscreenExited() override; |
178 virtual void SetVisibleFraction(double visible_fraction) OVERRIDE; | 178 virtual void SetVisibleFraction(double visible_fraction) override; |
179 virtual std::vector<gfx::Rect> GetVisibleBoundsInScreen() const OVERRIDE; | 179 virtual std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; |
180 | 180 |
181 // The widget that the caption buttons act on. | 181 // The widget that the caption buttons act on. |
182 views::Widget* frame_; | 182 views::Widget* frame_; |
183 | 183 |
184 // Helper for painting the header. | 184 // Helper for painting the header. |
185 scoped_ptr<DefaultHeaderPainter> header_painter_; | 185 scoped_ptr<DefaultHeaderPainter> header_painter_; |
186 | 186 |
187 views::ImageView* avatar_icon_; | 187 views::ImageView* avatar_icon_; |
188 | 188 |
189 // View which contains the window caption buttons. | 189 // View which contains the window caption buttons. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // View which takes up the entire widget and contains the HeaderView. HeaderView | 366 // View which takes up the entire widget and contains the HeaderView. HeaderView |
367 // is a child of OverlayView to avoid creating a larger texture than necessary | 367 // is a child of OverlayView to avoid creating a larger texture than necessary |
368 // when painting the HeaderView to its own layer. | 368 // when painting the HeaderView to its own layer. |
369 class CustomFrameViewAsh::OverlayView : public views::View, | 369 class CustomFrameViewAsh::OverlayView : public views::View, |
370 public views::ViewTargeterDelegate { | 370 public views::ViewTargeterDelegate { |
371 public: | 371 public: |
372 explicit OverlayView(HeaderView* header_view); | 372 explicit OverlayView(HeaderView* header_view); |
373 virtual ~OverlayView(); | 373 virtual ~OverlayView(); |
374 | 374 |
375 // views::View: | 375 // views::View: |
376 virtual void Layout() OVERRIDE; | 376 virtual void Layout() override; |
377 | 377 |
378 private: | 378 private: |
379 // views::ViewTargeterDelegate: | 379 // views::ViewTargeterDelegate: |
380 virtual bool DoesIntersectRect(const views::View* target, | 380 virtual bool DoesIntersectRect(const views::View* target, |
381 const gfx::Rect& rect) const OVERRIDE; | 381 const gfx::Rect& rect) const override; |
382 | 382 |
383 HeaderView* header_view_; | 383 HeaderView* header_view_; |
384 | 384 |
385 DISALLOW_COPY_AND_ASSIGN(OverlayView); | 385 DISALLOW_COPY_AND_ASSIGN(OverlayView); |
386 }; | 386 }; |
387 | 387 |
388 CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view) | 388 CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view) |
389 : header_view_(header_view) { | 389 : header_view_(header_view) { |
390 AddChildView(header_view); | 390 AddChildView(header_view); |
391 SetEventTargeter( | 391 SetEventTargeter( |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 FrameCaptionButtonContainerView* CustomFrameViewAsh:: | 578 FrameCaptionButtonContainerView* CustomFrameViewAsh:: |
579 GetFrameCaptionButtonContainerViewForTest() { | 579 GetFrameCaptionButtonContainerViewForTest() { |
580 return header_view_->caption_button_container(); | 580 return header_view_->caption_button_container(); |
581 } | 581 } |
582 | 582 |
583 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 583 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
584 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 584 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
585 } | 585 } |
586 | 586 |
587 } // namespace ash | 587 } // namespace ash |
OLD | NEW |