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

Side by Side Diff: chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.cc

Issue 25108005: linux_aura: Compile ash into chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reupload to try off of ToT instead of LKGR Created 6 years, 7 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 | Annotate | Revision Log
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 "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"
8 #include "chrome/browser/themes/theme_service_factory.h"
9 #include "chrome/browser/ui/views/frame/browser_frame.h"
10 #include "chrome/browser/ui/views/frame/browser_view.h"
11 #include "chrome/browser/ui/views/theme_image_mapper.h"
12
13 namespace {
14
15 // DesktopThemeProvider maps resource ids using MapThemeImage(). This is
16 // necessary for BrowserDesktopWindowTreeHostWin so that it uses the windows
17 // theme images rather than the ash theme images.
18 //
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.
21 class DesktopThemeProvider : public ui::ThemeProvider {
22 public:
23 explicit DesktopThemeProvider(ThemeService* delegate)
24 : delegate_(delegate) {
25 }
26
27 virtual bool UsingNativeTheme() const OVERRIDE {
28 return delegate_->UsingNativeTheme();
29 }
30 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE {
31 if (delegate_->UsingNativeTheme())
32 return delegate_->GetImageSkiaNamed(id);
33
34 return delegate_->GetImageSkiaNamed(
35 chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id));
36 }
37 virtual SkColor GetColor(int id) const OVERRIDE {
38 return delegate_->GetColor(id);
39 }
40 virtual int GetDisplayProperty(int id) const OVERRIDE {
41 return delegate_->GetDisplayProperty(id);
42 }
43 virtual bool ShouldUseNativeFrame() const OVERRIDE {
44 return delegate_->ShouldUseNativeFrame();
45 }
46 virtual bool HasCustomImage(int id) const OVERRIDE {
47 return delegate_->HasCustomImage(
48 chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id));
49 }
50 virtual base::RefCountedMemory* GetRawData(
51 int id,
52 ui::ScaleFactor scale_factor) const OVERRIDE {
53 return delegate_->GetRawData(id, scale_factor);
54 }
55
56 private:
57 ThemeService* delegate_;
58
59 DISALLOW_COPY_AND_ASSIGN(DesktopThemeProvider);
60 };
61
62 } // namespace
63
7 //////////////////////////////////////////////////////////////////////////////// 64 ////////////////////////////////////////////////////////////////////////////////
8 // BrowserDesktopWindowTreeHostX11, public: 65 // BrowserDesktopWindowTreeHostX11, public:
9 66
10 BrowserDesktopWindowTreeHostX11::BrowserDesktopWindowTreeHostX11( 67 BrowserDesktopWindowTreeHostX11::BrowserDesktopWindowTreeHostX11(
11 views::internal::NativeWidgetDelegate* native_widget_delegate, 68 views::internal::NativeWidgetDelegate* native_widget_delegate,
12 views::DesktopNativeWidgetAura* desktop_native_widget_aura, 69 views::DesktopNativeWidgetAura* desktop_native_widget_aura,
13 BrowserView* browser_view) 70 BrowserView* browser_view,
71 BrowserFrame* browser_frame)
14 : DesktopWindowTreeHostX11(native_widget_delegate, 72 : DesktopWindowTreeHostX11(native_widget_delegate,
15 desktop_native_widget_aura), 73 desktop_native_widget_aura),
16 browser_view_(browser_view) { 74 browser_view_(browser_view) {
75 scoped_ptr<ui::ThemeProvider> theme_provider(
76 new DesktopThemeProvider(ThemeServiceFactory::GetForProfile(
77 browser_view->browser()->profile())));
78 browser_frame->SetThemeProvider(theme_provider.Pass());
17 } 79 }
18 80
19 BrowserDesktopWindowTreeHostX11::~BrowserDesktopWindowTreeHostX11() { 81 BrowserDesktopWindowTreeHostX11::~BrowserDesktopWindowTreeHostX11() {
20 } 82 }
21 83
22 //////////////////////////////////////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////////////////
23 // BrowserDesktopWindowTreeHostX11, 85 // BrowserDesktopWindowTreeHostX11,
24 // BrowserDesktopWindowTreeHost implementation: 86 // BrowserDesktopWindowTreeHost implementation:
25 87
26 views::DesktopWindowTreeHost* 88 views::DesktopWindowTreeHost*
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 122
61 // static 123 // static
62 BrowserDesktopWindowTreeHost* 124 BrowserDesktopWindowTreeHost*
63 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( 125 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost(
64 views::internal::NativeWidgetDelegate* native_widget_delegate, 126 views::internal::NativeWidgetDelegate* native_widget_delegate,
65 views::DesktopNativeWidgetAura* desktop_native_widget_aura, 127 views::DesktopNativeWidgetAura* desktop_native_widget_aura,
66 BrowserView* browser_view, 128 BrowserView* browser_view,
67 BrowserFrame* browser_frame) { 129 BrowserFrame* browser_frame) {
68 return new BrowserDesktopWindowTreeHostX11(native_widget_delegate, 130 return new BrowserDesktopWindowTreeHostX11(native_widget_delegate,
69 desktop_native_widget_aura, 131 desktop_native_widget_aura,
70 browser_view); 132 browser_view,
133 browser_frame);
71 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698