OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_frame_aura.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/themes/theme_service.h" | 8 #include "chrome/browser/themes/theme_service.h" |
9 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h" | 9 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
11 #include "grit/theme_resources_standard.h" | 11 #include "grit/theme_resources_standard.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/aura/aura_switches.h" | 15 #include "ui/aura/aura_switches.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/theme_provider.h" | 17 #include "ui/base/theme_provider.h" |
18 #include "ui/gfx/canvas.h" | 18 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/compositor/layer.h" | 19 #include "ui/gfx/compositor/layer.h" |
20 #include "ui/gfx/font.h" | 20 #include "ui/gfx/font.h" |
21 #include "views/background.h" | 21 #include "views/background.h" |
22 | 22 |
| 23 #if defined(TOUCH_UI) |
| 24 #include "chrome/browser/ui/touch/sensors/screen_orientation_listener.h" |
| 25 #endif |
| 26 |
23 namespace { | 27 namespace { |
24 | 28 |
25 // The content left/right images have a shadow built into them. | 29 // The content left/right images have a shadow built into them. |
26 const int kContentEdgeShadowThickness = 2; | 30 const int kContentEdgeShadowThickness = 2; |
27 | 31 |
28 // Background view to paint the gradient behind the back/forward/omnibox | 32 // Background view to paint the gradient behind the back/forward/omnibox |
29 // toolbar area. | 33 // toolbar area. |
30 class ToolbarBackground : public views::Background { | 34 class ToolbarBackground : public views::Background { |
31 public: | 35 public: |
32 explicit ToolbarBackground(BrowserView* browser_view); | 36 explicit ToolbarBackground(BrowserView* browser_view); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 browser_view_(browser_view), | 167 browser_view_(browser_view), |
164 browser_frame_(browser_frame) { | 168 browser_frame_(browser_frame) { |
165 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraWindows)) { | 169 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraWindows)) { |
166 // Aura paints layers behind this view, so this must be a layer also. | 170 // Aura paints layers behind this view, so this must be a layer also. |
167 // TODO: see if we can avoid this, layers are expensive. | 171 // TODO: see if we can avoid this, layers are expensive. |
168 browser_view_->SetPaintToLayer(true); | 172 browser_view_->SetPaintToLayer(true); |
169 browser_view_->layer()->SetFillsBoundsOpaquely(false); | 173 browser_view_->layer()->SetFillsBoundsOpaquely(false); |
170 // Background only needed for Aura-style windows. | 174 // Background only needed for Aura-style windows. |
171 browser_view_->set_background(new ToolbarBackground(browser_view)); | 175 browser_view_->set_background(new ToolbarBackground(browser_view)); |
172 } | 176 } |
| 177 |
| 178 #if defined(TOUCH_UI) |
| 179 // Ensure that the screen orientation listener singleton is initialized. |
| 180 ScreenOrientationListener::GetInstance(); |
| 181 #endif |
173 } | 182 } |
174 | 183 |
175 BrowserFrameAura::~BrowserFrameAura() { | 184 BrowserFrameAura::~BrowserFrameAura() { |
176 } | 185 } |
177 | 186 |
178 /////////////////////////////////////////////////////////////////////////////// | 187 /////////////////////////////////////////////////////////////////////////////// |
179 // BrowserFrameAura, views::NativeWidgetAura overrides: | 188 // BrowserFrameAura, views::NativeWidgetAura overrides: |
180 | 189 |
181 //////////////////////////////////////////////////////////////////////////////// | 190 //////////////////////////////////////////////////////////////////////////////// |
182 // BrowserFrameAura, NativeBrowserFrame implementation: | 191 // BrowserFrameAura, NativeBrowserFrame implementation: |
(...skipping 24 matching lines...) Expand all Loading... |
207 | 216 |
208 //////////////////////////////////////////////////////////////////////////////// | 217 //////////////////////////////////////////////////////////////////////////////// |
209 // NativeBrowserFrame, public: | 218 // NativeBrowserFrame, public: |
210 | 219 |
211 // static | 220 // static |
212 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( | 221 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( |
213 BrowserFrame* browser_frame, | 222 BrowserFrame* browser_frame, |
214 BrowserView* browser_view) { | 223 BrowserView* browser_view) { |
215 return new BrowserFrameAura(browser_frame, browser_view); | 224 return new BrowserFrameAura(browser_frame, browser_view); |
216 } | 225 } |
OLD | NEW |