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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Sync with ToT 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
« no previous file with comments | « ui/views/bubble/bubble_frame_view.h ('k') | ui/views/button_drag_utils.cc » ('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 "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(
412 paint_info.context(), paint_info.paint_recording_size(),
413 paint_info.paint_recording_scale_x(),
414 paint_info.paint_recording_scale_y(), &paint_cache);
411 OnPaintBorder(recorder.canvas()); 415 OnPaintBorder(recorder.canvas());
412 } 416 }
413 417
414 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) { 418 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) {
415 if (sender == close_) { 419 if (sender == close_) {
416 close_button_clicked_ = true; 420 close_button_clicked_ = true;
417 GetWidget()->Close(); 421 GetWidget()->Close();
418 } 422 }
419 } 423 }
420 424
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 573
570 DialogDelegate* dialog_delegate = 574 DialogDelegate* dialog_delegate =
571 GetWidget()->widget_delegate()->AsDialogDelegate(); 575 GetWidget()->widget_delegate()->AsDialogDelegate();
572 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth()) 576 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth())
573 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width())); 577 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width()));
574 578
575 return size; 579 return size;
576 } 580 }
577 581
578 } // namespace views 582 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_frame_view.h ('k') | ui/views/button_drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698