Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ui/views/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 active_ = active; | 213 active_ = active; |
| 214 SchedulePaint(); | 214 SchedulePaint(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 /////////////////////////////////////////////////////////////////////////////// | 217 /////////////////////////////////////////////////////////////////////////////// |
| 218 // CustomFrameView, View overrides: | 218 // CustomFrameView, View overrides: |
| 219 | 219 |
| 220 void CustomFrameView::OnPaint(gfx::Canvas* canvas) { | 220 void CustomFrameView::OnPaint(gfx::Canvas* canvas) { |
| 221 if (!ShouldShowTitleBarAndBorder()) | 221 if (!ShouldShowTitleBarAndBorder()) |
| 222 return; | 222 return; |
| 223 | 223 |
|
sky
2017/01/11 21:54:52
Any reason not to call set_is_active here? Calling
Tom (Use chromium acct)
2017/01/11 22:44:48
I added the set_is_active right after set_frame_co
sky
2017/01/12 00:58:14
SGTM
Tom (Use chromium acct)
2017/01/12 01:47:29
Done.
| |
| 224 if (frame_->IsMaximized()) | 224 if (frame_->IsMaximized()) |
| 225 PaintMaximizedFrameBorder(canvas); | 225 PaintMaximizedFrameBorder(canvas); |
| 226 else | 226 else |
| 227 PaintRestoredFrameBorder(canvas); | 227 PaintRestoredFrameBorder(canvas); |
| 228 PaintTitleBar(canvas); | 228 PaintTitleBar(canvas); |
| 229 if (ShouldShowClientEdge()) | 229 if (ShouldShowClientEdge()) |
| 230 PaintRestoredClientEdge(canvas); | 230 PaintRestoredClientEdge(canvas); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void CustomFrameView::Layout() { | 233 void CustomFrameView::Layout() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 | 353 |
| 354 return true; | 354 return true; |
| 355 } | 355 } |
| 356 | 356 |
| 357 bool CustomFrameView::ShouldShowClientEdge() const { | 357 bool CustomFrameView::ShouldShowClientEdge() const { |
| 358 return !frame_->IsMaximized() && ShouldShowTitleBarAndBorder(); | 358 return !frame_->IsMaximized() && ShouldShowTitleBarAndBorder(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { | 361 void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { |
| 362 frame_background_->set_frame_color(GetFrameColor()); | 362 frame_background_->set_frame_color(GetFrameColor()); |
| 363 frame_background_->set_is_active(ShouldPaintAsActive()); | |
| 363 const gfx::ImageSkia frame_image = GetFrameImage(); | 364 const gfx::ImageSkia frame_image = GetFrameImage(); |
| 364 frame_background_->set_theme_image(frame_image); | 365 frame_background_->set_theme_image(frame_image); |
| 365 frame_background_->set_top_area_height(frame_image.height()); | 366 frame_background_->set_top_area_height(frame_image.height()); |
| 366 | 367 |
| 367 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 368 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 368 | 369 |
| 369 frame_background_->SetCornerImages( | 370 frame_background_->SetCornerImages( |
| 370 rb.GetImageNamed(IDR_WINDOW_TOP_LEFT_CORNER).ToImageSkia(), | 371 rb.GetImageNamed(IDR_WINDOW_TOP_LEFT_CORNER).ToImageSkia(), |
| 371 rb.GetImageNamed(IDR_WINDOW_TOP_RIGHT_CORNER).ToImageSkia(), | 372 rb.GetImageNamed(IDR_WINDOW_TOP_RIGHT_CORNER).ToImageSkia(), |
| 372 rb.GetImageNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER).ToImageSkia(), | 373 rb.GetImageNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER).ToImageSkia(), |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 } | 639 } |
| 639 case views::FRAME_BUTTON_CLOSE: { | 640 case views::FRAME_BUTTON_CLOSE: { |
| 640 button = close_button_; | 641 button = close_button_; |
| 641 break; | 642 break; |
| 642 } | 643 } |
| 643 } | 644 } |
| 644 return button; | 645 return button; |
| 645 } | 646 } |
| 646 | 647 |
| 647 } // namespace views | 648 } // namespace views |
| OLD | NEW |