[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ui / views_content_client / views_content_client_main_parts.cc
blobdcb0e47ebd5446b963654c69ff32904fd25c21d4
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 "ui/views_content_client/views_content_client_main_parts.h"
7 #include "base/run_loop.h"
8 #include "content/public/browser/context_factory.h"
9 #include "content/shell/browser/shell_browser_context.h"
10 #include "ui/base/ime/input_method_initializer.h"
11 #include "ui/views/test/desktop_test_views_delegate.h"
13 namespace ui {
15 ViewsContentClientMainParts::ViewsContentClientMainParts(
16 const content::MainFunctionParams& content_params,
17 ViewsContentClient* views_content_client)
18 : views_content_client_(views_content_client) {
21 ViewsContentClientMainParts::~ViewsContentClientMainParts() {
24 void ViewsContentClientMainParts::PreMainMessageLoopRun() {
25 ui::InitializeInputMethodForTesting();
26 browser_context_.reset(new content::ShellBrowserContext(false, NULL));
28 scoped_ptr<views::TestViewsDelegate> test_views_delegate(
29 new views::DesktopTestViewsDelegate);
30 test_views_delegate->set_context_factory(content::GetContextFactory());
31 views_delegate_ = test_views_delegate.Pass();
34 void ViewsContentClientMainParts::PostMainMessageLoopRun() {
35 browser_context_.reset();
36 views_delegate_.reset();
39 bool ViewsContentClientMainParts::MainMessageLoopRun(int* result_code) {
40 base::RunLoop run_loop;
41 run_loop.Run();
42 return true;
45 } // namespace ui