[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ui / views_content_client / views_content_client_main_parts_desktop_aura.cc
blob93401e607b51a916157996a439c722b5b2ee0add
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/shell/browser/shell_browser_context.h"
6 #include "ui/aura/env.h"
7 #include "ui/gfx/screen.h"
8 #include "ui/views/widget/desktop_aura/desktop_screen.h"
9 #include "ui/views_content_client/views_content_client.h"
10 #include "ui/views_content_client/views_content_client_main_parts_aura.h"
12 namespace ui {
14 namespace {
16 class ViewsContentClientMainPartsDesktopAura
17 : public ViewsContentClientMainPartsAura {
18 public:
19 ViewsContentClientMainPartsDesktopAura(
20 const content::MainFunctionParams& content_params,
21 ViewsContentClient* views_content_client);
22 ~ViewsContentClientMainPartsDesktopAura() override {}
24 // content::BrowserMainParts:
25 void PreMainMessageLoopRun() override;
27 private:
28 DISALLOW_COPY_AND_ASSIGN(ViewsContentClientMainPartsDesktopAura);
31 ViewsContentClientMainPartsDesktopAura::ViewsContentClientMainPartsDesktopAura(
32 const content::MainFunctionParams& content_params,
33 ViewsContentClient* views_content_client)
34 : ViewsContentClientMainPartsAura(content_params, views_content_client) {
37 void ViewsContentClientMainPartsDesktopAura::PreMainMessageLoopRun() {
38 ViewsContentClientMainPartsAura::PreMainMessageLoopRun();
40 aura::Env::CreateInstance(true);
41 gfx::Screen::SetScreenInstance(
42 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
44 views_content_client()->task().Run(browser_context(), NULL);
47 } // namespace
49 // static
50 ViewsContentClientMainParts* ViewsContentClientMainParts::Create(
51 const content::MainFunctionParams& content_params,
52 ViewsContentClient* views_content_client) {
53 return new ViewsContentClientMainPartsDesktopAura(
54 content_params, views_content_client);
57 } // namespace ui