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

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

Issue 441803004: Introduce new WebApp header style for hosted apps and fizzy apps on ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 6 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 "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"
11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
12 #include "ash/frame/default_header_painter.h" 12 #include "ash/frame/default_header_painter.h"
13 #include "ash/frame/frame_border_hit_test_controller.h" 13 #include "ash/frame/frame_border_hit_test_controller.h"
14 #include "ash/frame/frame_util.h" 14 #include "ash/frame/frame_util.h"
15 #include "ash/frame/header_painter.h" 15 #include "ash/frame/header_painter.h"
16 #include "ash/frame/header_painter_util.h"
pkotwicz 2014/08/13 01:19:47 Nit: Remove unnecessary include
benwells 2014/08/13 08:09:28 Done.
16 #include "ash/session/session_state_delegate.h" 17 #include "ash/session/session_state_delegate.h"
17 #include "ash/shell.h" 18 #include "ash/shell.h"
18 #include "ash/shell_observer.h" 19 #include "ash/shell_observer.h"
19 #include "ash/wm/immersive_fullscreen_controller.h" 20 #include "ash/wm/immersive_fullscreen_controller.h"
20 #include "ash/wm/window_state.h" 21 #include "ash/wm/window_state.h"
21 #include "ash/wm/window_state_delegate.h" 22 #include "ash/wm/window_state_delegate.h"
22 #include "ash/wm/window_state_observer.h" 23 #include "ash/wm/window_state_observer.h"
23 #include "base/command_line.h" 24 #include "base/command_line.h"
24 #include "ui/aura/client/aura_constants.h" 25 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // that the window frame can be minimized if it can be maximized. 205 // that the window frame can be minimized if it can be maximized.
205 FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed = 206 FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed =
206 frame_->widget_delegate()->CanMaximize() ? 207 frame_->widget_delegate()->CanMaximize() ?
207 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED : 208 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED :
208 FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED; 209 FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED;
209 caption_button_container_ = new FrameCaptionButtonContainerView(frame_, 210 caption_button_container_ = new FrameCaptionButtonContainerView(frame_,
210 minimize_allowed); 211 minimize_allowed);
211 caption_button_container_->UpdateSizeButtonVisibility(); 212 caption_button_container_->UpdateSizeButtonVisibility();
212 AddChildView(caption_button_container_); 213 AddChildView(caption_button_container_);
213 214
214 header_painter_->Init(frame_, this, NULL, caption_button_container_); 215 header_painter_->Init(frame_, this, caption_button_container_);
215 UpdateAvatarIcon(); 216 UpdateAvatarIcon();
216 217
217 Shell::GetInstance()->AddShellObserver(this); 218 Shell::GetInstance()->AddShellObserver(this);
218 } 219 }
219 220
220 CustomFrameViewAsh::HeaderView::~HeaderView() { 221 CustomFrameViewAsh::HeaderView::~HeaderView() {
221 Shell::GetInstance()->RemoveShellObserver(this); 222 Shell::GetInstance()->RemoveShellObserver(this);
222 } 223 }
223 224
224 void CustomFrameViewAsh::HeaderView::SchedulePaintForTitle() { 225 void CustomFrameViewAsh::HeaderView::SchedulePaintForTitle() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 delegate->GetBrowserContextForWindow(window)).AsImageSkia(); 262 delegate->GetBrowserContextForWindow(window)).AsImageSkia();
262 DCHECK(!image.isNull()); 263 DCHECK(!image.isNull());
263 DCHECK_EQ(image.width(), image.height()); 264 DCHECK_EQ(image.width(), image.height());
264 if (!avatar_icon_) { 265 if (!avatar_icon_) {
265 avatar_icon_ = new views::ImageView(); 266 avatar_icon_ = new views::ImageView();
266 AddChildView(avatar_icon_); 267 AddChildView(avatar_icon_);
267 } 268 }
268 avatar_icon_->SetImage(image); 269 avatar_icon_->SetImage(image);
269 icon_size = image.width(); 270 icon_size = image.width();
270 } 271 }
271 header_painter_->UpdateWindowIcon(avatar_icon_, icon_size); 272 header_painter_->UpdateLeftHeaderView(avatar_icon_, icon_size);
272 Layout(); 273 Layout();
273 } 274 }
274 275
275 /////////////////////////////////////////////////////////////////////////////// 276 ///////////////////////////////////////////////////////////////////////////////
276 // CustomFrameViewAsh::HeaderView, views::View overrides: 277 // CustomFrameViewAsh::HeaderView, views::View overrides:
277 278
278 void CustomFrameViewAsh::HeaderView::Layout() { 279 void CustomFrameViewAsh::HeaderView::Layout() {
279 header_painter_->LayoutHeader(); 280 header_painter_->LayoutHeader();
280 } 281 }
281 282
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 571 FrameCaptionButtonContainerView* CustomFrameViewAsh::
571 GetFrameCaptionButtonContainerViewForTest() { 572 GetFrameCaptionButtonContainerViewForTest() {
572 return header_view_->caption_button_container(); 573 return header_view_->caption_button_container();
573 } 574 }
574 575
575 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 576 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
576 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 577 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
577 } 578 }
578 579
579 } // namespace ash 580 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698