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

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

Issue 2618383004: Revert of Move more vector icons to respective directories and update code to (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/default_header_painter.h" 5 #include "ash/common/frame/default_header_painter.h"
6 6
7 #include "ash/common/ash_layout_constants.h" 7 #include "ash/common/ash_layout_constants.h"
8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h " 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h "
9 #include "ash/common/frame/header_painter_util.h" 9 #include "ash/common/frame/header_painter_util.h"
10 #include "ash/resources/vector_icons/vector_icons.h"
11 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
12 #include "base/logging.h" // DCHECK 11 #include "base/logging.h" // DCHECK
13 #include "grit/ash_resources.h" 12 #include "grit/ash_resources.h"
14 #include "third_party/skia/include/core/SkPaint.h" 13 #include "third_party/skia/include/core/SkPaint.h"
15 #include "third_party/skia/include/core/SkPath.h" 14 #include "third_party/skia/include/core/SkPath.h"
16 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/animation/slide_animation.h" 16 #include "ui/gfx/animation/slide_animation.h"
18 #include "ui/gfx/canvas.h" 17 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/color_utils.h" 18 #include "ui/gfx/color_utils.h"
20 #include "ui/gfx/font_list.h" 19 #include "ui/gfx/font_list.h"
21 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
22 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
23 #include "ui/gfx/scoped_canvas.h" 22 #include "ui/gfx/scoped_canvas.h"
24 #include "ui/gfx/skia_util.h" 23 #include "ui/gfx/skia_util.h"
24 #include "ui/gfx/vector_icons_public.h"
25 #include "ui/views/view.h" 25 #include "ui/views/view.h"
26 #include "ui/views/widget/native_widget_aura.h" 26 #include "ui/views/widget/native_widget_aura.h"
27 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
28 #include "ui/views/widget/widget_delegate.h" 28 #include "ui/views/widget/widget_delegate.h"
29 29
30 using views::Widget; 30 using views::Widget;
31 31
32 namespace { 32 namespace {
33 33
34 // Color for the window title text. 34 // Color for the window title text.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); 276 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
277 } 277 }
278 278
279 bool DefaultHeaderPainter::ShouldUseLightImages() { 279 bool DefaultHeaderPainter::ShouldUseLightImages() {
280 return color_utils::IsDark(mode_ == MODE_INACTIVE ? inactive_frame_color_ 280 return color_utils::IsDark(mode_ == MODE_INACTIVE ? inactive_frame_color_
281 : active_frame_color_); 281 : active_frame_color_);
282 } 282 }
283 283
284 void DefaultHeaderPainter::UpdateAllButtonImages() { 284 void DefaultHeaderPainter::UpdateAllButtonImages() {
285 caption_button_container_->SetUseLightImages(ShouldUseLightImages()); 285 caption_button_container_->SetUseLightImages(ShouldUseLightImages());
286 caption_button_container_->SetButtonImage(CAPTION_BUTTON_ICON_MINIMIZE, 286 caption_button_container_->SetButtonImage(
287 kWindowControlMinimizeIcon); 287 CAPTION_BUTTON_ICON_MINIMIZE, gfx::VectorIconId::WINDOW_CONTROL_MINIMIZE);
288 288
289 UpdateSizeButtonImages(); 289 UpdateSizeButtonImages();
290 290
291 caption_button_container_->SetButtonImage(CAPTION_BUTTON_ICON_CLOSE, 291 caption_button_container_->SetButtonImage(
292 kWindowControlCloseIcon); 292 CAPTION_BUTTON_ICON_CLOSE, gfx::VectorIconId::WINDOW_CONTROL_CLOSE);
293 293
294 caption_button_container_->SetButtonImage(CAPTION_BUTTON_ICON_LEFT_SNAPPED, 294 caption_button_container_->SetButtonImage(
295 kWindowControlLeftSnappedIcon); 295 CAPTION_BUTTON_ICON_LEFT_SNAPPED,
296 gfx::VectorIconId::WINDOW_CONTROL_LEFT_SNAPPED);
296 297
297 caption_button_container_->SetButtonImage(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, 298 caption_button_container_->SetButtonImage(
298 kWindowControlRightSnappedIcon); 299 CAPTION_BUTTON_ICON_RIGHT_SNAPPED,
300 gfx::VectorIconId::WINDOW_CONTROL_RIGHT_SNAPPED);
299 } 301 }
300 302
301 void DefaultHeaderPainter::UpdateSizeButtonImages() { 303 void DefaultHeaderPainter::UpdateSizeButtonImages() {
302 const gfx::VectorIcon& icon = frame_->IsMaximized() || frame_->IsFullscreen() 304 gfx::VectorIconId icon_id = frame_->IsMaximized() || frame_->IsFullscreen()
303 ? kWindowControlRestoreIcon 305 ? gfx::VectorIconId::WINDOW_CONTROL_RESTORE
304 : kWindowControlMaximizeIcon; 306 : gfx::VectorIconId::WINDOW_CONTROL_MAXIMIZE;
305 caption_button_container_->SetButtonImage( 307 caption_button_container_->SetButtonImage(
306 CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, icon); 308 CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, icon_id);
307 } 309 }
308 310
309 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const { 311 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const {
310 return gfx::Rect(view_->width(), painted_height_); 312 return gfx::Rect(view_->width(), painted_height_);
311 } 313 }
312 314
313 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const { 315 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const {
314 return HeaderPainterUtil::GetTitleBounds( 316 return HeaderPainterUtil::GetTitleBounds(
315 left_header_view_, caption_button_container_, GetTitleFontList()); 317 left_header_view_, caption_button_container_, GetTitleFontList());
316 } 318 }
317 319
318 bool DefaultHeaderPainter::UsesCustomFrameColors() const { 320 bool DefaultHeaderPainter::UsesCustomFrameColors() const {
319 return active_frame_color_ != kDefaultFrameColor || 321 return active_frame_color_ != kDefaultFrameColor ||
320 inactive_frame_color_ != kDefaultFrameColor; 322 inactive_frame_color_ != kDefaultFrameColor;
321 } 323 }
322 324
323 } // namespace ash 325 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698