OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 #include "ui/base/hit_test.h" | 126 #include "ui/base/hit_test.h" |
127 #include "ui/base/l10n/l10n_util.h" | 127 #include "ui/base/l10n/l10n_util.h" |
128 #include "ui/base/resource/material_design/material_design_controller.h" | 128 #include "ui/base/resource/material_design/material_design_controller.h" |
129 #include "ui/base/resource/resource_bundle.h" | 129 #include "ui/base/resource/resource_bundle.h" |
130 #include "ui/base/theme_provider.h" | 130 #include "ui/base/theme_provider.h" |
131 #include "ui/content_accelerators/accelerator_util.h" | 131 #include "ui/content_accelerators/accelerator_util.h" |
132 #include "ui/events/event_utils.h" | 132 #include "ui/events/event_utils.h" |
133 #include "ui/gfx/canvas.h" | 133 #include "ui/gfx/canvas.h" |
134 #include "ui/gfx/color_utils.h" | 134 #include "ui/gfx/color_utils.h" |
135 #include "ui/gfx/geometry/rect_conversions.h" | 135 #include "ui/gfx/geometry/rect_conversions.h" |
| 136 #include "ui/gfx/scoped_canvas.h" |
136 #include "ui/gfx/screen.h" | 137 #include "ui/gfx/screen.h" |
137 #include "ui/strings/grit/ui_strings.h" | 138 #include "ui/strings/grit/ui_strings.h" |
138 #include "ui/views/controls/button/menu_button.h" | 139 #include "ui/views/controls/button/menu_button.h" |
139 #include "ui/views/controls/textfield/textfield.h" | 140 #include "ui/views/controls/textfield/textfield.h" |
140 #include "ui/views/controls/webview/webview.h" | 141 #include "ui/views/controls/webview/webview.h" |
141 #include "ui/views/focus/external_focus_tracker.h" | 142 #include "ui/views/focus/external_focus_tracker.h" |
142 #include "ui/views/focus/view_storage.h" | 143 #include "ui/views/focus/view_storage.h" |
143 #include "ui/views/layout/grid_layout.h" | 144 #include "ui/views/layout/grid_layout.h" |
144 #include "ui/views/widget/native_widget.h" | 145 #include "ui/views/widget/native_widget.h" |
145 #include "ui/views/widget/root_view.h" | 146 #include "ui/views/widget/root_view.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 544 |
544 // static | 545 // static |
545 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { | 546 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { |
546 return static_cast<BrowserView*>(browser->window()); | 547 return static_cast<BrowserView*>(browser->window()); |
547 } | 548 } |
548 | 549 |
549 // static | 550 // static |
550 void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas, | 551 void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas, |
551 SkColor color, | 552 SkColor color, |
552 const gfx::Rect& bounds) { | 553 const gfx::Rect& bounds) { |
553 const float scale = canvas->SaveAndUnscale(); | 554 gfx::ScopedCanvas scoped_canvas(canvas); |
| 555 const float scale = canvas->UndoDeviceScaleFactor(); |
554 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); | 556 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); |
555 rect.Inset(0, rect.height() - 1, 0, 0); | 557 rect.Inset(0, rect.height() - 1, 0, 0); |
556 SkPaint paint; | 558 SkPaint paint; |
557 paint.setColor(color); | 559 paint.setColor(color); |
558 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); | 560 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); |
559 canvas->Restore(); | |
560 } | 561 } |
561 | 562 |
562 void BrowserView::InitStatusBubble() { | 563 void BrowserView::InitStatusBubble() { |
563 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); | 564 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); |
564 contents_web_view_->SetStatusBubble(status_bubble_.get()); | 565 contents_web_view_->SetStatusBubble(status_bubble_.get()); |
565 } | 566 } |
566 | 567 |
567 gfx::Rect BrowserView::GetToolbarBounds() const { | 568 gfx::Rect BrowserView::GetToolbarBounds() const { |
568 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 569 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
569 if (toolbar_bounds.IsEmpty()) | 570 if (toolbar_bounds.IsEmpty()) |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 return immersive_mode_controller()->IsEnabled(); | 2631 return immersive_mode_controller()->IsEnabled(); |
2631 } | 2632 } |
2632 | 2633 |
2633 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2634 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2634 return GetWidget(); | 2635 return GetWidget(); |
2635 } | 2636 } |
2636 | 2637 |
2637 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2638 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2638 return top_container_->GetBoundsInScreen(); | 2639 return top_container_->GetBoundsInScreen(); |
2639 } | 2640 } |
OLD | NEW |