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.
4
5#include "ui/views_content_client/views_content_client_main_parts.h"
6
7#include "base/run_loop.h"
8#include "content/shell/browser/shell_browser_context.h"
9#include "ui/base/ime/input_method_initializer.h"
10#include "ui/views/test/desktop_test_views_delegate.h"
11
12namespace ui {
13
14ViewsContentClientMainParts::ViewsContentClientMainParts(
15    const content::MainFunctionParams& content_params,
16    ViewsContentClient* views_content_client)
17    : views_content_client_(views_content_client) {
18}
19
20ViewsContentClientMainParts::~ViewsContentClientMainParts() {
21}
22
23void ViewsContentClientMainParts::PreMainMessageLoopRun() {
24  ui::InitializeInputMethodForTesting();
25  browser_context_.reset(new content::ShellBrowserContext(false, NULL));
26  views_delegate_.reset(new views::DesktopTestViewsDelegate);
27}
28
29void ViewsContentClientMainParts::PostMainMessageLoopRun() {
30  browser_context_.reset();
31  views_delegate_.reset();
32}
33
34bool ViewsContentClientMainParts::MainMessageLoopRun(int* result_code) {
35  base::RunLoop run_loop;
36  run_loop.Run();
37  return true;
38}
39
40}  // namespace ui
41