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

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: Rebase 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
« no previous file with comments | « ash/frame/caption_buttons/frame_size_button.cc ('k') | ash/frame/default_header_painter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // that the window frame can be minimized if it can be maximized. 204 // that the window frame can be minimized if it can be maximized.
205 FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed = 205 FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed =
206 frame_->widget_delegate()->CanMaximize() ? 206 frame_->widget_delegate()->CanMaximize() ?
207 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED : 207 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED :
208 FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED; 208 FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED;
209 caption_button_container_ = new FrameCaptionButtonContainerView(frame_, 209 caption_button_container_ = new FrameCaptionButtonContainerView(frame_,
210 minimize_allowed); 210 minimize_allowed);
211 caption_button_container_->UpdateSizeButtonVisibility(); 211 caption_button_container_->UpdateSizeButtonVisibility();
212 AddChildView(caption_button_container_); 212 AddChildView(caption_button_container_);
213 213
214 header_painter_->Init(frame_, this, NULL, caption_button_container_); 214 header_painter_->Init(frame_, this, caption_button_container_);
215 UpdateAvatarIcon(); 215 UpdateAvatarIcon();
216 216
217 Shell::GetInstance()->AddShellObserver(this); 217 Shell::GetInstance()->AddShellObserver(this);
218 } 218 }
219 219
220 CustomFrameViewAsh::HeaderView::~HeaderView() { 220 CustomFrameViewAsh::HeaderView::~HeaderView() {
221 Shell::GetInstance()->RemoveShellObserver(this); 221 Shell::GetInstance()->RemoveShellObserver(this);
222 } 222 }
223 223
224 void CustomFrameViewAsh::HeaderView::SchedulePaintForTitle() { 224 void CustomFrameViewAsh::HeaderView::SchedulePaintForTitle() {
(...skipping 18 matching lines...) Expand all
243 243
244 int CustomFrameViewAsh::HeaderView::GetMinimumWidth() const { 244 int CustomFrameViewAsh::HeaderView::GetMinimumWidth() const {
245 return header_painter_->GetMinimumHeaderWidth(); 245 return header_painter_->GetMinimumHeaderWidth();
246 } 246 }
247 247
248 void CustomFrameViewAsh::HeaderView::UpdateAvatarIcon() { 248 void CustomFrameViewAsh::HeaderView::UpdateAvatarIcon() {
249 SessionStateDelegate* delegate = 249 SessionStateDelegate* delegate =
250 Shell::GetInstance()->session_state_delegate(); 250 Shell::GetInstance()->session_state_delegate();
251 aura::Window* window = frame_->GetNativeView(); 251 aura::Window* window = frame_->GetNativeView();
252 bool show = delegate->ShouldShowAvatar(window); 252 bool show = delegate->ShouldShowAvatar(window);
253 int icon_size = 0;
254 if (!show) { 253 if (!show) {
255 if (!avatar_icon_) 254 if (!avatar_icon_)
256 return; 255 return;
257 delete avatar_icon_; 256 delete avatar_icon_;
258 avatar_icon_ = NULL; 257 avatar_icon_ = NULL;
259 } else { 258 } else {
260 gfx::ImageSkia image = GetAvatarImageForContext( 259 gfx::ImageSkia image = GetAvatarImageForContext(
261 delegate->GetBrowserContextForWindow(window)).AsImageSkia(); 260 delegate->GetBrowserContextForWindow(window)).AsImageSkia();
262 DCHECK(!image.isNull()); 261 DCHECK(!image.isNull());
263 DCHECK_EQ(image.width(), image.height()); 262 DCHECK_EQ(image.width(), image.height());
264 if (!avatar_icon_) { 263 if (!avatar_icon_) {
265 avatar_icon_ = new views::ImageView(); 264 avatar_icon_ = new views::ImageView();
266 AddChildView(avatar_icon_); 265 AddChildView(avatar_icon_);
267 } 266 }
268 avatar_icon_->SetImage(image); 267 avatar_icon_->SetImage(image);
269 icon_size = image.width();
270 } 268 }
271 header_painter_->UpdateWindowIcon(avatar_icon_, icon_size); 269 header_painter_->UpdateLeftHeaderView(avatar_icon_);
272 Layout(); 270 Layout();
273 } 271 }
274 272
275 /////////////////////////////////////////////////////////////////////////////// 273 ///////////////////////////////////////////////////////////////////////////////
276 // CustomFrameViewAsh::HeaderView, views::View overrides: 274 // CustomFrameViewAsh::HeaderView, views::View overrides:
277 275
278 void CustomFrameViewAsh::HeaderView::Layout() { 276 void CustomFrameViewAsh::HeaderView::Layout() {
279 header_painter_->LayoutHeader(); 277 header_painter_->LayoutHeader();
280 } 278 }
281 279
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 568 FrameCaptionButtonContainerView* CustomFrameViewAsh::
571 GetFrameCaptionButtonContainerViewForTest() { 569 GetFrameCaptionButtonContainerViewForTest() {
572 return header_view_->caption_button_container(); 570 return header_view_->caption_button_container();
573 } 571 }
574 572
575 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 573 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
576 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 574 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
577 } 575 }
578 576
579 } // namespace ash 577 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/caption_buttons/frame_size_button.cc ('k') | ash/frame/default_header_painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698