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

Side by Side Diff: ash/common/frame/header_view.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 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
« no previous file with comments | « no previous file | ash/common/shelf/overflow_bubble_view.cc » ('j') | ui/views/animation/ink_drop.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/frame/header_view.h" 5 #include "ash/common/frame/header_view.h"
6 6
7 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h " 7 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h "
8 #include "ash/common/frame/default_header_painter.h" 8 #include "ash/common/frame/default_header_painter.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/wm_lookup.h" 10 #include "ash/common/wm_lookup.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ui/compositor/layer_type.h"
12 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
13 #include "ui/views/controls/image_view.h" 14 #include "ui/views/controls/image_view.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 namespace ash { 17 namespace ash {
17 18
18 HeaderView::HeaderView(views::Widget* target_widget) 19 HeaderView::HeaderView(views::Widget* target_widget)
19 : target_widget_(target_widget), 20 : target_widget_(target_widget),
20 header_painter_(new DefaultHeaderPainter), 21 header_painter_(new DefaultHeaderPainter),
21 avatar_icon_(nullptr), 22 avatar_icon_(nullptr),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 views::View* HeaderView::avatar_icon() const { 158 views::View* HeaderView::avatar_icon() const {
158 return avatar_icon_; 159 return avatar_icon_;
159 } 160 }
160 161
161 /////////////////////////////////////////////////////////////////////////////// 162 ///////////////////////////////////////////////////////////////////////////////
162 // HeaderView, 163 // HeaderView,
163 // ImmersiveFullscreenControllerDelegate overrides: 164 // ImmersiveFullscreenControllerDelegate overrides:
164 165
165 void HeaderView::OnImmersiveRevealStarted() { 166 void HeaderView::OnImmersiveRevealStarted() {
166 fullscreen_visible_fraction_ = 0; 167 fullscreen_visible_fraction_ = 0;
167 SetPaintToLayer(true); 168 SetPaintToLayer(ui::LAYER_TEXTURED);
168 layer()->SetFillsBoundsOpaquely(false); 169 layer()->SetFillsBoundsOpaquely(false);
169 parent()->Layout(); 170 parent()->Layout();
170 } 171 }
171 172
172 void HeaderView::OnImmersiveRevealEnded() { 173 void HeaderView::OnImmersiveRevealEnded() {
173 fullscreen_visible_fraction_ = 0; 174 fullscreen_visible_fraction_ = 0;
174 SetPaintToLayer(false); 175 SetPaintToLayer(ui::LAYER_NOT_DRAWN);
175 parent()->Layout(); 176 parent()->Layout();
176 } 177 }
177 178
178 void HeaderView::OnImmersiveFullscreenExited() { 179 void HeaderView::OnImmersiveFullscreenExited() {
179 fullscreen_visible_fraction_ = 0; 180 fullscreen_visible_fraction_ = 0;
180 SetPaintToLayer(false); 181 SetPaintToLayer(ui::LAYER_NOT_DRAWN);
181 parent()->Layout(); 182 parent()->Layout();
182 } 183 }
183 184
184 void HeaderView::SetVisibleFraction(double visible_fraction) { 185 void HeaderView::SetVisibleFraction(double visible_fraction) {
185 if (fullscreen_visible_fraction_ != visible_fraction) { 186 if (fullscreen_visible_fraction_ != visible_fraction) {
186 fullscreen_visible_fraction_ = visible_fraction; 187 fullscreen_visible_fraction_ = visible_fraction;
187 parent()->Layout(); 188 parent()->Layout();
188 } 189 }
189 } 190 }
190 191
191 std::vector<gfx::Rect> HeaderView::GetVisibleBoundsInScreen() const { 192 std::vector<gfx::Rect> HeaderView::GetVisibleBoundsInScreen() const {
192 // TODO(pkotwicz): Implement views::View::ConvertRectToScreen(). 193 // TODO(pkotwicz): Implement views::View::ConvertRectToScreen().
193 gfx::Rect visible_bounds(GetVisibleBounds()); 194 gfx::Rect visible_bounds(GetVisibleBounds());
194 gfx::Point visible_origin_in_screen(visible_bounds.origin()); 195 gfx::Point visible_origin_in_screen(visible_bounds.origin());
195 views::View::ConvertPointToScreen(this, &visible_origin_in_screen); 196 views::View::ConvertPointToScreen(this, &visible_origin_in_screen);
196 std::vector<gfx::Rect> bounds_in_screen; 197 std::vector<gfx::Rect> bounds_in_screen;
197 bounds_in_screen.push_back( 198 bounds_in_screen.push_back(
198 gfx::Rect(visible_origin_in_screen, visible_bounds.size())); 199 gfx::Rect(visible_origin_in_screen, visible_bounds.size()));
199 return bounds_in_screen; 200 return bounds_in_screen;
200 } 201 }
201 202
202 } // namespace ash 203 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/shelf/overflow_bubble_view.cc » ('j') | ui/views/animation/ink_drop.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698