Skip to content

Commit

Permalink
Revert of Remove remote tree host and some related input and metro_dr…
Browse files Browse the repository at this point in the history
…iver code (patchset chromium#5 id:80001 of https://codereview.chromium.org/1586843002/ )

Reason for revert:
Suspecting that this is breaking the Webkit Win (dbg) builder.

First failed build:
https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Win%20Builder%20%28dbg%29/builds/88362

Original issue's description:
> Remove remote tree host and some related input and metro_driver code
>
> Part of continued stripping out of Metro/Win8/Immersive mode.
>
> BUG=558054
>
> Committed: https://crrev.com/5cc04f70e424020d8afe49bdc4c1c76683f0ea7b
> Cr-Commit-Position: refs/heads/master@{#370068}

TBR=sky@chromium.org,thestig@chromium.org,shuchen@chromium.org,ananta@chromium.org,dpranke@chromium.org,scottmg@chromium.org
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
BUG=558054

Review URL: https://codereview.chromium.org/1602403002

Cr-Commit-Position: refs/heads/master@{#370290}
  • Loading branch information
lisamuel authored and Commit bot committed Jan 20, 2016
1 parent 15d94b7 commit 0e3a9fd
Show file tree
Hide file tree
Showing 63 changed files with 8,006 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ash/ash.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
'gpu_support_stub.h',
'high_contrast/high_contrast_controller.cc',
'high_contrast/high_contrast_controller.h',
'host/ash_remote_window_tree_host_win.cc',
'host/ash_remote_window_tree_host_win.h',
'host/ash_window_tree_host.cc',
'host/ash_window_tree_host.h',
'host/ash_window_tree_host_init_params.cc',
Expand Down
16 changes: 15 additions & 1 deletion ash/ash_unittests.isolate
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
},
}],
['chromeos==1', {
['OS=="win" or chromeos==1', {
'variables': {
'files': [
'../testing/test_env.py',
Expand All @@ -52,6 +52,20 @@
],
},
}],
['OS=="win"', {
'variables': {
'files': [
'<(PRODUCT_DIR)/osmesa.dll',
],
},
}],
['OS=="win" and (fastbuild==0 or fastbuild==1)', {
'variables': {
'files': [
'<(PRODUCT_DIR)/ash_unittests.exe.pdb',
],
},
}],
],
'includes': [
'../base/base.isolate',
Expand Down
71 changes: 71 additions & 0 deletions ash/host/ash_remote_window_tree_host_win.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/host/ash_remote_window_tree_host_win.h"

#include "ash/host/root_window_transformer.h"
#include "ash/ime/input_method_event_handler.h"
#include "ui/events/event_processor.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/transform.h"

namespace ash {

AshRemoteWindowTreeHostWin::AshRemoteWindowTreeHostWin(HWND remote_hwnd)
: aura::RemoteWindowTreeHostWin(),
transformer_helper_(this) {
SetRemoteWindowHandle(remote_hwnd);
transformer_helper_.Init();
}

AshRemoteWindowTreeHostWin::~AshRemoteWindowTreeHostWin() {}

void AshRemoteWindowTreeHostWin::ToggleFullScreen() {}

bool AshRemoteWindowTreeHostWin::ConfineCursorToRootWindow() { return false; }

void AshRemoteWindowTreeHostWin::UnConfineCursor() {}

void AshRemoteWindowTreeHostWin::SetRootWindowTransformer(
scoped_ptr<RootWindowTransformer> transformer) {
transformer_helper_.SetRootWindowTransformer(transformer.Pass());
}

gfx::Insets AshRemoteWindowTreeHostWin::GetHostInsets() const {
return gfx::Insets();
}

aura::WindowTreeHost* AshRemoteWindowTreeHostWin::AsWindowTreeHost() {
return this;
}

gfx::Transform AshRemoteWindowTreeHostWin::GetRootTransform() const {
return transformer_helper_.GetTransform();
}

void AshRemoteWindowTreeHostWin::SetRootTransform(
const gfx::Transform& transform) {
transformer_helper_.SetTransform(transform);
}

gfx::Transform AshRemoteWindowTreeHostWin::GetInverseRootTransform() const {
return transformer_helper_.GetInverseTransform();
}

void AshRemoteWindowTreeHostWin::UpdateRootWindowSize(
const gfx::Size& host_size) {
transformer_helper_.UpdateWindowSize(host_size);
}

ui::EventDispatchDetails AshRemoteWindowTreeHostWin::DispatchKeyEventPostIME(
ui::KeyEvent* event) {
input_method_handler()->SetPostIME(true);
ui::EventDispatchDetails details =
event_processor()->OnEventFromSource(event);
if (!details.dispatcher_destroyed)
input_method_handler()->SetPostIME(false);
return details;
}

} // namespace ash
53 changes: 53 additions & 0 deletions ash/host/ash_remote_window_tree_host_win.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_HOST_REMOTE_WINDOW_TREE_HOST_WIN_H_
#define ASH_HOST_REMOTE_WINDOW_TREE_HOST_WIN_H_

#include <windows.h>

#include "ash/ash_export.h"
#include "ash/host/ash_window_tree_host.h"
#include "ash/host/transformer_helper.h"
#include "base/macros.h"
#include "ui/aura/remote_window_tree_host_win.h"

namespace ash {

class ASH_EXPORT AshRemoteWindowTreeHostWin
: public AshWindowTreeHost,
public aura::RemoteWindowTreeHostWin {
public:
explicit AshRemoteWindowTreeHostWin(HWND remote_hwnd);

private:
~AshRemoteWindowTreeHostWin() override;

// AshWindowTreeHost:
void ToggleFullScreen() override;
bool ConfineCursorToRootWindow() override;
void UnConfineCursor() override;
void SetRootWindowTransformer(
scoped_ptr<RootWindowTransformer> transformer) override;
gfx::Insets GetHostInsets() const override;
aura::WindowTreeHost* AsWindowTreeHost() override;

// WindowTreeHostWin:
gfx::Transform GetRootTransform() const override;
void SetRootTransform(const gfx::Transform& transform) override;
gfx::Transform GetInverseRootTransform() const override;
void UpdateRootWindowSize(const gfx::Size& host_size) override;

// ui::internal::InputMethodDelegate:
ui::EventDispatchDetails DispatchKeyEventPostIME(
ui::KeyEvent* event) override;

TransformerHelper transformer_helper_;

DISALLOW_COPY_AND_ASSIGN(AshRemoteWindowTreeHostWin);
};

} // namespace ash

#endif // ASH_HOST_REMOTE_WINDOW_TREE_HOST_WIN_H_
6 changes: 6 additions & 0 deletions ash/host/ash_window_tree_host_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "ash/ash_export.h"
#include "ash/ash_switches.h"
#include "ash/host/ash_remote_window_tree_host_win.h"
#include "ash/host/ash_window_tree_host_init_params.h"
#include "ash/host/root_window_transformer.h"
#include "ash/host/transformer_helper.h"
Expand Down Expand Up @@ -122,6 +123,11 @@ class AshWindowTreeHostWin : public AshWindowTreeHost,

AshWindowTreeHost* AshWindowTreeHost::Create(
const AshWindowTreeHostInitParams& init_params) {
if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kForceAshToDesktop))
return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd);

return new AshWindowTreeHostWin(init_params.initial_bounds);
}

Expand Down
1 change: 1 addition & 0 deletions ash/test/ash_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "ui/aura/remote_window_tree_host_win.h"
#include "ui/platform_window/win/win_window.h"
#include "win8/test/test_registrar_constants.h"
#endif
Expand Down
1 change: 1 addition & 0 deletions build/gn_migration.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@
'../third_party/codesighs/codesighs.gyp:msdump2symdb',
'../third_party/codesighs/codesighs.gyp:msmap2tsv',
'../third_party/pdfium/samples/samples.gyp:pdfium_diff',
'../win8/win8.gyp:metro_viewer',
],
}],
['chromecast==1', {
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ source_set("browser") {
"//third_party/isimpledom",
"//third_party/wtl",
"//ui/metro_viewer",
"//win8:metro_viewer",
]

all_dependent_configs = [ ":browser_win_linker_flags" ]
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/browser_process_platform_part.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "chrome/browser/browser_process_platform_part_chromeos.h"
#elif defined(OS_MACOSX) && !defined(OS_IOS)
#include "chrome/browser/browser_process_platform_part_mac.h"
#elif defined(OS_WIN)
#include "chrome/browser/browser_process_platform_part_aurawin.h"
#else
#include "chrome/browser/browser_process_platform_part_base.h"
typedef BrowserProcessPlatformPartBase BrowserProcessPlatformPart;
Expand Down
72 changes: 72 additions & 0 deletions chrome/browser/browser_process_platform_part_aurawin.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/browser_process_platform_part_aurawin.h"

#include "base/command_line.h"
#include "base/logging.h"
#include "base/prefs/pref_service.h"
#include "base/process/kill.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/first_run/upgrade_util.h"
#include "chrome/browser/first_run/upgrade_util_win.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"

#include "ui/aura/remote_window_tree_host_win.h"
#include "ui/base/ui_base_switches.h"

BrowserProcessPlatformPart::BrowserProcessPlatformPart() {
if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
// Tell metro viewer to close when we are shutting down.
registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
}
}

BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
}

void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() {
metro_viewer_process_host_.reset(NULL);
}

void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing(
const base::CommandLine& command_line) {
// Check for Windows 8 specific commandlines requesting that this process
// either connect to an existing viewer or launch a new viewer and
// synchronously wait for it to connect.

bool launch = command_line.HasSwitch(switches::kViewerLaunchViaAppId);
bool connect = (launch ||
(command_line.HasSwitch(switches::kViewerConnect) &&
!metro_viewer_process_host_.get()));
if (!connect)
return;
// Create a host to connect to the Metro viewer process over IPC.
metro_viewer_process_host_.reset(new ChromeMetroViewerProcessHost());
if (launch) {
CHECK(metro_viewer_process_host_->LaunchViewerAndWaitForConnection(
command_line.GetSwitchValueNative(
switches::kViewerLaunchViaAppId)));
}
}

void BrowserProcessPlatformPart::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

DCHECK(type == chrome::NOTIFICATION_APP_TERMINATING);
PrefService* pref_service = g_browser_process->local_state();
bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted);
if (is_relaunch) {
// TODO(scottmg): A lot of this can be removed http://crbug.com/558054.
}
}
45 changes: 45 additions & 0 deletions chrome/browser/browser_process_platform_part_aurawin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_AURAWIN_H_
#define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_AURAWIN_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/browser_process_platform_part_base.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"

class ChromeMetroViewerProcessHost;

class BrowserProcessPlatformPart : public BrowserProcessPlatformPartBase,
public content::NotificationObserver {
public:
BrowserProcessPlatformPart();
~BrowserProcessPlatformPart() override;

// Invoked when the ASH metro viewer process on Windows 8 exits.
void OnMetroViewerProcessTerminated();

// Overridden from BrowserProcessPlatformPartBase:
void PlatformSpecificCommandLineProcessing(
const base::CommandLine& command_line) override;

// content::NotificationObserver method:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;

private:
// Hosts the channel for the Windows 8 metro viewer process which runs in
// the ASH environment.
scoped_ptr<ChromeMetroViewerProcessHost> metro_viewer_process_host_;

content::NotificationRegistrar registrar_;

DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPart);
};

#endif // CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_AURAWIN_H_
9 changes: 9 additions & 0 deletions chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
#include "extensions/browser/notification_types.h"
#include "ui/base/l10n/l10n_util.h"

#if defined(OS_WIN)
#include "ui/aura/remote_window_tree_host_win.h"
#endif

using bookmarks::BookmarkModel;
using bookmarks::BookmarkNode;
using bookmarks::ManagedBookmarkService;
Expand Down Expand Up @@ -794,6 +798,11 @@ void BookmarksIOFunction::ShowSelectFileDialog(
gfx::NativeWindow owning_window = web_contents ?
platform_util::GetTopLevel(web_contents->GetNativeView())
: NULL;
#if defined(OS_WIN)
if (!owning_window &&
chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
owning_window = aura::RemoteWindowTreeHostWin::Instance()->GetAshWindow();
#endif
// |web_contents| can be NULL (for background pages), which is fine. In such
// a case if file-selection dialogs are forbidden by policy, we will not
// show an InfoBar, which is better than letting one appear out of the blue.
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/metro_viewer/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include_rules = [
"+win8/viewer",
]
3 changes: 3 additions & 0 deletions chrome/browser/metro_viewer/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ananta@chromium.org
cpu@chromium.org
scottmg@chromium.org
Loading

0 comments on commit 0e3a9fd

Please sign in to comment.