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/paint_vector_icon.h" | |
136 #include "ui/gfx/scoped_canvas.h" | 137 #include "ui/gfx/scoped_canvas.h" |
137 #include "ui/gfx/screen.h" | 138 #include "ui/gfx/screen.h" |
139 #include "ui/gfx/vector_icons_public.h" | |
138 #include "ui/strings/grit/ui_strings.h" | 140 #include "ui/strings/grit/ui_strings.h" |
139 #include "ui/views/controls/button/menu_button.h" | 141 #include "ui/views/controls/button/menu_button.h" |
140 #include "ui/views/controls/textfield/textfield.h" | 142 #include "ui/views/controls/textfield/textfield.h" |
141 #include "ui/views/controls/webview/webview.h" | 143 #include "ui/views/controls/webview/webview.h" |
142 #include "ui/views/focus/external_focus_tracker.h" | 144 #include "ui/views/focus/external_focus_tracker.h" |
143 #include "ui/views/focus/view_storage.h" | 145 #include "ui/views/focus/view_storage.h" |
144 #include "ui/views/layout/grid_layout.h" | 146 #include "ui/views/layout/grid_layout.h" |
145 #include "ui/views/widget/native_widget.h" | 147 #include "ui/views/widget/native_widget.h" |
146 #include "ui/views/widget/root_view.h" | 148 #include "ui/views/widget/root_view.h" |
147 #include "ui/views/widget/widget.h" | 149 #include "ui/views/widget/widget.h" |
148 #include "ui/views/window/dialog_delegate.h" | 150 #include "ui/views/window/dialog_delegate.h" |
149 | 151 |
150 #if defined(USE_AURA) | 152 #if defined(USE_AURA) |
151 #include "ui/aura/client/window_tree_client.h" | 153 #include "ui/aura/client/window_tree_client.h" |
152 #include "ui/aura/window.h" | 154 #include "ui/aura/window.h" |
153 #include "ui/aura/window_tree_host.h" | 155 #include "ui/aura/window_tree_host.h" |
154 #endif | 156 #endif |
155 | 157 |
156 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
157 #include "base/win/windows_version.h" | 159 #include "base/win/windows_version.h" |
158 #include "chrome/browser/jumplist_win.h" | 160 #include "chrome/browser/jumplist_win.h" |
161 #include "ui/gfx/color_palette.h" | |
159 #include "ui/views/win/scoped_fullscreen_visibility.h" | 162 #include "ui/views/win/scoped_fullscreen_visibility.h" |
160 #endif | 163 #endif |
161 | 164 |
162 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 165 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
163 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" | 166 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" |
164 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" | 167 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" |
165 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" | 168 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
166 #endif | 169 #endif |
167 | 170 |
168 #if defined(OS_CHROMEOS) | 171 #if defined(OS_CHROMEOS) |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 | 677 |
675 bool BrowserView::IsAcceleratorRegistered(const ui::Accelerator& accelerator) { | 678 bool BrowserView::IsAcceleratorRegistered(const ui::Accelerator& accelerator) { |
676 return accelerator_table_.find(accelerator) != accelerator_table_.end(); | 679 return accelerator_table_.find(accelerator) != accelerator_table_.end(); |
677 } | 680 } |
678 | 681 |
679 WebContents* BrowserView::GetActiveWebContents() const { | 682 WebContents* BrowserView::GetActiveWebContents() const { |
680 return browser_->tab_strip_model()->GetActiveWebContents(); | 683 return browser_->tab_strip_model()->GetActiveWebContents(); |
681 } | 684 } |
682 | 685 |
683 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { | 686 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { |
684 return *GetThemeProvider()->GetImageSkiaNamed(IDR_OTR_ICON); | 687 if (ui::MaterialDesignController::IsModeMaterial()) { |
688 SkColor icon_color = SK_ColorWHITE; | |
689 #if defined(OS_WIN) | |
690 // On Windows 10, we can't change the frame color so must assume it's white. | |
691 if (base::win::GetVersion() == base::win::VERSION_WIN10) | |
692 icon_color = gfx::kChromeIconGrey; | |
693 #endif | |
694 return gfx::CreateVectorIcon(gfx::VectorIconId::INCOGNITO, 24, icon_color); | |
695 } | |
696 | |
697 // GetThemeProvider() can return null if this view is not yet part of the | |
698 // widget hierarchy, but the frame's theme provider is always valid. | |
699 return *frame_->GetThemeProvider()->GetImageSkiaNamed(IDR_OTR_ICON); | |
Evan Stade
2015/11/18 23:06:56
slight change here from previous patchsets, please
Peter Kasting
2015/11/18 23:21:56
Wouldn't this have been a bug with the existing co
Evan Stade
2015/11/18 23:49:11
BrowserView::GetOTRAvatarIcon is now called in mor
| |
685 } | 700 } |
686 | 701 |
687 /////////////////////////////////////////////////////////////////////////////// | 702 /////////////////////////////////////////////////////////////////////////////// |
688 // BrowserView, BrowserWindow implementation: | 703 // BrowserView, BrowserWindow implementation: |
689 | 704 |
690 void BrowserView::Show() { | 705 void BrowserView::Show() { |
691 #if !defined(OS_WIN) | 706 #if !defined(OS_WIN) |
692 // The Browser associated with this browser window must become the active | 707 // The Browser associated with this browser window must become the active |
693 // browser at the time |Show()| is called. This is the natural behavior under | 708 // browser at the time |Show()| is called. This is the natural behavior under |
694 // Windows and Ash, but other platforms will not trigger | 709 // Windows and Ash, but other platforms will not trigger |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2656 return immersive_mode_controller()->IsEnabled(); | 2671 return immersive_mode_controller()->IsEnabled(); |
2657 } | 2672 } |
2658 | 2673 |
2659 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2674 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2660 return GetWidget(); | 2675 return GetWidget(); |
2661 } | 2676 } |
2662 | 2677 |
2663 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2678 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2664 return top_container_->GetBoundsInScreen(); | 2679 return top_container_->GetBoundsInScreen(); |
2665 } | 2680 } |
OLD | NEW |