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

Side by Side Diff: ui/views/bubble/bubble_frame_view.cc

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Resolving comments Created 3 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
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 "ui/views/bubble/bubble_frame_view.h" 5 #include "ui/views/bubble/bubble_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "components/vector_icons/vector_icons.h" 11 #include "components/vector_icons/vector_icons.h"
12 #include "ui/base/default_style.h" 12 #include "ui/base/default_style.h"
13 #include "ui/base/hit_test.h" 13 #include "ui/base/hit_test.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/material_design/material_design_controller.h" 15 #include "ui/base/material_design/material_design_controller.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/compositor/paint_context.h"
18 #include "ui/compositor/paint_recorder.h" 17 #include "ui/compositor/paint_recorder.h"
19 #include "ui/display/display.h" 18 #include "ui/display/display.h"
20 #include "ui/display/screen.h" 19 #include "ui/display/screen.h"
21 #include "ui/gfx/geometry/vector2d.h" 20 #include "ui/gfx/geometry/vector2d.h"
22 #include "ui/gfx/path.h" 21 #include "ui/gfx/path.h"
23 #include "ui/gfx/skia_util.h" 22 #include "ui/gfx/skia_util.h"
24 #include "ui/native_theme/native_theme.h" 23 #include "ui/native_theme/native_theme.h"
25 #include "ui/resources/grit/ui_resources.h" 24 #include "ui/resources/grit/ui_resources.h"
26 #include "ui/strings/grit/ui_strings.h" 25 #include "ui/strings/grit/ui_strings.h"
27 #include "ui/views/bubble/bubble_border.h" 26 #include "ui/views/bubble/bubble_border.h"
28 #include "ui/views/bubble/bubble_dialog_delegate.h" 27 #include "ui/views/bubble/bubble_dialog_delegate.h"
29 #include "ui/views/controls/button/image_button.h" 28 #include "ui/views/controls/button/image_button.h"
30 #include "ui/views/controls/button/image_button_factory.h" 29 #include "ui/views/controls/button/image_button_factory.h"
31 #include "ui/views/controls/image_view.h" 30 #include "ui/views/controls/image_view.h"
32 #include "ui/views/layout/box_layout.h" 31 #include "ui/views/layout/box_layout.h"
33 #include "ui/views/layout/layout_provider.h" 32 #include "ui/views/layout/layout_provider.h"
33 #include "ui/views/paint_info.h"
34 #include "ui/views/resources/grit/views_resources.h" 34 #include "ui/views/resources/grit/views_resources.h"
35 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
36 #include "ui/views/widget/widget_delegate.h" 36 #include "ui/views/widget/widget_delegate.h"
37 #include "ui/views/window/client_view.h" 37 #include "ui/views/window/client_view.h"
38 #include "ui/views/window/dialog_delegate.h" 38 #include "ui/views/window/dialog_delegate.h"
39 39
40 namespace views { 40 namespace views {
41 41
42 namespace { 42 namespace {
43 43
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 footnote_container_->SetVisible(false); 397 footnote_container_->SetVisible(false);
398 footnote_container_ = nullptr; 398 footnote_container_ = nullptr;
399 } 399 }
400 } 400 }
401 401
402 void BubbleFrameView::OnPaint(gfx::Canvas* canvas) { 402 void BubbleFrameView::OnPaint(gfx::Canvas* canvas) {
403 OnPaintBackground(canvas); 403 OnPaintBackground(canvas);
404 // Border comes after children. 404 // Border comes after children.
405 } 405 }
406 406
407 void BubbleFrameView::PaintChildren(const ui::PaintContext& context) { 407 void BubbleFrameView::PaintChildren(const PaintInfo& paint_info) {
408 NonClientFrameView::PaintChildren(context); 408 NonClientFrameView::PaintChildren(paint_info);
409 409
410 ui::PaintRecorder recorder(context, size()); 410 ui::PaintCache paint_cache;
411 ui::PaintRecorder recorder(paint_info.context(),
412 paint_info.paint_recording_size(),
413 paint_info.paint_recording_scale(), &paint_cache);
411 OnPaintBorder(recorder.canvas()); 414 OnPaintBorder(recorder.canvas());
412 } 415 }
413 416
414 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) { 417 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) {
415 if (sender == close_) { 418 if (sender == close_) {
416 close_button_clicked_ = true; 419 close_button_clicked_ = true;
417 GetWidget()->Close(); 420 GetWidget()->Close();
418 } 421 }
419 } 422 }
420 423
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 572
570 DialogDelegate* dialog_delegate = 573 DialogDelegate* dialog_delegate =
571 GetWidget()->widget_delegate()->AsDialogDelegate(); 574 GetWidget()->widget_delegate()->AsDialogDelegate();
572 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth()) 575 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth())
573 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width())); 576 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width()));
574 577
575 return size; 578 return size;
576 } 579 }
577 580
578 } // namespace views 581 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698