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

Unified Diff: ui/views_content_client/views_content_client_main_parts.cc

Issue 284113011: Repurpose views+content example into a generic multiprocess views runtime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase for r272332 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 side-by-side diff with in-line comments
Download patch
Index: ui/views_content_client/views_content_client_main_parts.cc
diff --git a/ui/views/examples/content_client/examples_browser_main_parts.cc b/ui/views_content_client/views_content_client_main_parts.cc
similarity index 64%
rename from ui/views/examples/content_client/examples_browser_main_parts.cc
rename to ui/views_content_client/views_content_client_main_parts.cc
index 159b9315c78a40ed6fa15296d18c30e9fbbdf2d3..b4fea47ffcd3f822c21ea5c19b369a2161f1f989 100644
--- a/ui/views/examples/content_client/examples_browser_main_parts.cc
+++ b/ui/views_content_client/views_content_client_main_parts.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/views/examples/content_client/examples_browser_main_parts.h"
+#include "ui/views_content_client/views_content_client_main_parts.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -17,11 +17,10 @@
#include "ui/aura/env.h"
#include "ui/base/ime/input_method_initializer.h"
#include "ui/gfx/screen.h"
-#include "ui/views/examples/examples_window_with_content.h"
#include "ui/views/test/desktop_test_views_delegate.h"
#include "ui/views/widget/native_widget_aura.h"
+#include "ui/views_content_client/views_content_client.h"
#include "ui/wm/core/wm_state.h"
-#include "url/gurl.h"
#if defined(OS_CHROMEOS)
#include "ui/aura/test/test_screen.h"
@@ -32,21 +31,22 @@
#include "ui/views/widget/desktop_aura/desktop_screen.h"
#endif
-namespace views {
-namespace examples {
+namespace ui {
-ExamplesBrowserMainParts::ExamplesBrowserMainParts(
- const content::MainFunctionParams& parameters) {
+ViewsContentClientMainParts::ViewsContentClientMainParts(
+ const content::MainFunctionParams& content_params,
+ ViewsContentClient* views_content_client)
+ : views_content_client_(views_content_client) {
}
-ExamplesBrowserMainParts::~ExamplesBrowserMainParts() {
+ViewsContentClientMainParts::~ViewsContentClientMainParts() {
}
-void ExamplesBrowserMainParts::ToolkitInitialized() {
- wm_state_.reset(new wm::WMState);
+void ViewsContentClientMainParts::ToolkitInitialized() {
+ wm_state_.reset(new ::wm::WMState);
}
-void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
+void ViewsContentClientMainParts::PreMainMessageLoopRun() {
ui::InitializeInputMethodForTesting();
browser_context_.reset(new content::ShellBrowserContext(false, NULL));
@@ -55,8 +55,8 @@ void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create());
// Set up basic pieces of views::corewm.
- wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600),
- content::GetContextFactory()));
+ wm_test_helper_.reset(new ::wm::WMTestHelper(gfx::Size(800, 600),
+ content::GetContextFactory()));
// Ensure the X window gets mapped.
wm_test_helper_->host()->Show();
// Ensure Aura knows where to open new windows.
@@ -64,15 +64,14 @@ void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
#else
aura::Env::CreateInstance(true);
gfx::Screen::SetScreenInstance(
- gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen());
+ gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
#endif
- views_delegate_.reset(new DesktopTestViewsDelegate);
+ views_delegate_.reset(new views::DesktopTestViewsDelegate);
- ShowExamplesWindowWithContent(
- QUIT_ON_CLOSE, browser_context_.get(), window_context);
+ views_content_client_->task().Run(browser_context_.get(), window_context);
}
-void ExamplesBrowserMainParts::PostMainMessageLoopRun() {
+void ViewsContentClientMainParts::PostMainMessageLoopRun() {
browser_context_.reset();
#if defined(OS_CHROMEOS)
wm_test_helper_.reset();
@@ -81,11 +80,10 @@ void ExamplesBrowserMainParts::PostMainMessageLoopRun() {
aura::Env::DeleteInstance();
}
-bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) {
+bool ViewsContentClientMainParts::MainMessageLoopRun(int* result_code) {
base::RunLoop run_loop;
run_loop.Run();
return true;
}
-} // namespace examples
-} // namespace views
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698