| OLD | NEW |
| 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 "apps/ui/views/app_window_frame_view.h" | 5 #include "apps/ui/views/app_window_frame_view.h" |
| 6 | 6 |
| 7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "extensions/common/draggable_region.h" | 9 #include "extensions/common/draggable_region.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 maximize_button_(NULL), | 44 maximize_button_(NULL), |
| 45 restore_button_(NULL), | 45 restore_button_(NULL), |
| 46 minimize_button_(NULL), | 46 minimize_button_(NULL), |
| 47 resize_inside_bounds_size_(0), | 47 resize_inside_bounds_size_(0), |
| 48 resize_outside_bounds_size_(0), | 48 resize_outside_bounds_size_(0), |
| 49 resize_area_corner_size_(0) {} | 49 resize_area_corner_size_(0) {} |
| 50 | 50 |
| 51 AppWindowFrameView::~AppWindowFrameView() {} | 51 AppWindowFrameView::~AppWindowFrameView() {} |
| 52 | 52 |
| 53 void AppWindowFrameView::Init(views::Widget* frame, | 53 void AppWindowFrameView::Init(views::Widget* frame, |
| 54 const SkColor& frame_color, |
| 54 int resize_inside_bounds_size, | 55 int resize_inside_bounds_size, |
| 55 int resize_outside_bounds_size, | 56 int resize_outside_bounds_size, |
| 56 int resize_outside_scale_for_touch, | 57 int resize_outside_scale_for_touch, |
| 57 int resize_area_corner_size) { | 58 int resize_area_corner_size) { |
| 58 frame_ = frame; | 59 frame_ = frame; |
| 60 frame_color_ = frame_color; |
| 59 resize_inside_bounds_size_ = resize_inside_bounds_size; | 61 resize_inside_bounds_size_ = resize_inside_bounds_size; |
| 60 resize_outside_bounds_size_ = resize_outside_bounds_size; | 62 resize_outside_bounds_size_ = resize_outside_bounds_size; |
| 61 resize_area_corner_size_ = resize_area_corner_size; | 63 resize_area_corner_size_ = resize_area_corner_size; |
| 62 | 64 |
| 63 if (!window_->IsFrameless()) { | 65 if (!window_->IsFrameless()) { |
| 64 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 66 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 65 close_button_ = new views::ImageButton(this); | 67 close_button_ = new views::ImageButton(this); |
| 66 close_button_->SetImage( | 68 close_button_->SetImage( |
| 67 views::CustomButton::STATE_NORMAL, | 69 views::CustomButton::STATE_NORMAL, |
| 68 rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE).ToImageSkia()); | 70 rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE).ToImageSkia()); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } else { | 302 } else { |
| 301 close_button_->SetImage( | 303 close_button_->SetImage( |
| 302 views::CustomButton::STATE_NORMAL, | 304 views::CustomButton::STATE_NORMAL, |
| 303 rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE_U).ToImageSkia()); | 305 rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE_U).ToImageSkia()); |
| 304 } | 306 } |
| 305 | 307 |
| 306 // TODO(jeremya): different look for inactive? | 308 // TODO(jeremya): different look for inactive? |
| 307 SkPaint paint; | 309 SkPaint paint; |
| 308 paint.setAntiAlias(false); | 310 paint.setAntiAlias(false); |
| 309 paint.setStyle(SkPaint::kFill_Style); | 311 paint.setStyle(SkPaint::kFill_Style); |
| 310 paint.setColor(SK_ColorWHITE); | 312 paint.setColor(frame_color_); |
| 311 gfx::Path path; | 313 gfx::Path path; |
| 312 path.moveTo(0, 0); | 314 path.moveTo(0, 0); |
| 313 path.lineTo(width(), 0); | 315 path.lineTo(width(), 0); |
| 314 path.lineTo(width(), kCaptionHeight); | 316 path.lineTo(width(), kCaptionHeight); |
| 315 path.lineTo(0, kCaptionHeight); | 317 path.lineTo(0, kCaptionHeight); |
| 316 path.close(); | 318 path.close(); |
| 317 canvas->DrawPath(path, paint); | 319 canvas->DrawPath(path, paint); |
| 318 } | 320 } |
| 319 | 321 |
| 320 const char* AppWindowFrameView::GetClassName() const { return kViewClassName; } | 322 const char* AppWindowFrameView::GetClassName() const { return kViewClassName; } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 frame_->Close(); | 360 frame_->Close(); |
| 359 else if (sender == maximize_button_) | 361 else if (sender == maximize_button_) |
| 360 frame_->Maximize(); | 362 frame_->Maximize(); |
| 361 else if (sender == restore_button_) | 363 else if (sender == restore_button_) |
| 362 frame_->Restore(); | 364 frame_->Restore(); |
| 363 else if (sender == minimize_button_) | 365 else if (sender == minimize_button_) |
| 364 frame_->Minimize(); | 366 frame_->Minimize(); |
| 365 } | 367 } |
| 366 | 368 |
| 367 } // namespace apps | 369 } // namespace apps |
| OLD | NEW |