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 "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" | 5 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" |
6 | 6 |
7 #include "chrome/browser/themes/theme_service.h" | 7 #include "chrome/browser/themes/theme_service.h" |
8 #include "chrome/browser/themes/theme_service_factory.h" | 8 #include "chrome/browser/themes/theme_service_factory.h" |
9 #include "chrome/browser/ui/views/frame/browser_frame.h" | 9 #include "chrome/browser/ui/views/frame/browser_frame.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
11 #include "chrome/browser/ui/views/theme_image_mapper.h" | 11 #include "chrome/browser/ui/views/theme_image_mapper.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // DesktopThemeProvider maps resource ids using MapThemeImage(). This is | 15 // DesktopThemeProvider maps resource ids using MapThemeImage(). This is |
16 // necessary for BrowserDesktopWindowTreeHostWin so that it uses the windows | 16 // necessary for BrowserDesktopWindowTreeHostWin so that it uses the windows |
17 // theme images rather than the ash theme images. | 17 // theme images rather than the ash theme images. |
18 // | 18 // |
19 // This differs from the version in browser_desktop_window_tree_host_win.cc | 19 // This differs from the version in browser_desktop_window_tree_host_win.cc |
20 // because we need to also look up whether we're using the native theme. | 20 // because we need to also look up whether we're using the native theme. |
21 class DesktopThemeProvider : public ui::ThemeProvider { | 21 class DesktopThemeProvider : public ui::ThemeProvider { |
22 public: | 22 public: |
23 explicit DesktopThemeProvider(ThemeService* delegate) | 23 explicit DesktopThemeProvider(ThemeService* delegate) |
24 : delegate_(delegate) { | 24 : delegate_(delegate) { |
25 } | 25 } |
26 | 26 |
27 virtual bool UsingSystemTheme() const OVERRIDE { | 27 virtual bool UsingSystemTheme() const override { |
28 return delegate_->UsingSystemTheme(); | 28 return delegate_->UsingSystemTheme(); |
29 } | 29 } |
30 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE { | 30 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const override { |
31 if (delegate_->UsingSystemTheme()) | 31 if (delegate_->UsingSystemTheme()) |
32 return delegate_->GetImageSkiaNamed(id); | 32 return delegate_->GetImageSkiaNamed(id); |
33 | 33 |
34 return delegate_->GetImageSkiaNamed( | 34 return delegate_->GetImageSkiaNamed( |
35 chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); | 35 chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); |
36 } | 36 } |
37 virtual SkColor GetColor(int id) const OVERRIDE { | 37 virtual SkColor GetColor(int id) const override { |
38 return delegate_->GetColor(id); | 38 return delegate_->GetColor(id); |
39 } | 39 } |
40 virtual int GetDisplayProperty(int id) const OVERRIDE { | 40 virtual int GetDisplayProperty(int id) const override { |
41 return delegate_->GetDisplayProperty(id); | 41 return delegate_->GetDisplayProperty(id); |
42 } | 42 } |
43 virtual bool ShouldUseNativeFrame() const OVERRIDE { | 43 virtual bool ShouldUseNativeFrame() const override { |
44 return delegate_->ShouldUseNativeFrame(); | 44 return delegate_->ShouldUseNativeFrame(); |
45 } | 45 } |
46 virtual bool HasCustomImage(int id) const OVERRIDE { | 46 virtual bool HasCustomImage(int id) const override { |
47 return delegate_->HasCustomImage( | 47 return delegate_->HasCustomImage( |
48 chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); | 48 chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); |
49 } | 49 } |
50 virtual base::RefCountedMemory* GetRawData( | 50 virtual base::RefCountedMemory* GetRawData( |
51 int id, | 51 int id, |
52 ui::ScaleFactor scale_factor) const OVERRIDE { | 52 ui::ScaleFactor scale_factor) const override { |
53 return delegate_->GetRawData(id, scale_factor); | 53 return delegate_->GetRawData(id, scale_factor); |
54 } | 54 } |
55 | 55 |
56 private: | 56 private: |
57 ThemeService* delegate_; | 57 ThemeService* delegate_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(DesktopThemeProvider); | 59 DISALLOW_COPY_AND_ASSIGN(DesktopThemeProvider); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace | 62 } // namespace |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( | 125 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( |
126 views::internal::NativeWidgetDelegate* native_widget_delegate, | 126 views::internal::NativeWidgetDelegate* native_widget_delegate, |
127 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 127 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
128 BrowserView* browser_view, | 128 BrowserView* browser_view, |
129 BrowserFrame* browser_frame) { | 129 BrowserFrame* browser_frame) { |
130 return new BrowserDesktopWindowTreeHostX11(native_widget_delegate, | 130 return new BrowserDesktopWindowTreeHostX11(native_widget_delegate, |
131 desktop_native_widget_aura, | 131 desktop_native_widget_aura, |
132 browser_view, | 132 browser_view, |
133 browser_frame); | 133 browser_frame); |
134 } | 134 } |
OLD | NEW |