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

Side by Side Diff: win8/metro_driver/chrome_app_view_ash.cc

Issue 15731003: Make the browser->metro_viewer IPC channel name a constant instead of hardcoding it in a few places… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix explicits Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « win8/delegate_execute/command_execute_impl.cc ('k') | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "win8/metro_driver/stdafx.h" 5 #include "win8/metro_driver/stdafx.h"
6 #include "win8/metro_driver/chrome_app_view_ash.h" 6 #include "win8/metro_driver/chrome_app_view_ash.h"
7 7
8 #include <corewindow.h> 8 #include <corewindow.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <windows.foundation.h> 10 #include <windows.foundation.h>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/win/metro.h" 18 #include "base/win/metro.h"
19 #include "base/win/win_util.h" 19 #include "base/win/win_util.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "ipc/ipc_channel.h" 21 #include "ipc/ipc_channel.h"
22 #include "ipc/ipc_channel_proxy.h" 22 #include "ipc/ipc_channel_proxy.h"
23 #include "ipc/ipc_sender.h" 23 #include "ipc/ipc_sender.h"
24 #include "ui/base/gestures/gesture_sequence.h" 24 #include "ui/base/gestures/gesture_sequence.h"
25 #include "ui/metro_viewer/metro_viewer_messages.h" 25 #include "ui/metro_viewer/metro_viewer_messages.h"
26 #include "win8/metro_driver/file_picker_ash.h" 26 #include "win8/metro_driver/file_picker_ash.h"
27 #include "win8/metro_driver/metro_driver.h" 27 #include "win8/metro_driver/metro_driver.h"
28 #include "win8/metro_driver/winrt_utils.h" 28 #include "win8/metro_driver/winrt_utils.h"
29 #include "win8/viewer/metro_viewer_constants.h"
29 30
30 typedef winfoundtn::ITypedEventHandler< 31 typedef winfoundtn::ITypedEventHandler<
31 winapp::Core::CoreApplicationView*, 32 winapp::Core::CoreApplicationView*,
32 winapp::Activation::IActivatedEventArgs*> ActivatedHandler; 33 winapp::Activation::IActivatedEventArgs*> ActivatedHandler;
33 34
34 typedef winfoundtn::ITypedEventHandler< 35 typedef winfoundtn::ITypedEventHandler<
35 winui::Core::CoreWindow*, 36 winui::Core::CoreWindow*,
36 winui::Core::PointerEventArgs*> PointerEventHandler; 37 winui::Core::PointerEventArgs*> PointerEventHandler;
37 38
38 typedef winfoundtn::ITypedEventHandler< 39 typedef winfoundtn::ITypedEventHandler<
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 DLOG(WARNING) << "activation failed hr=" << hr; 426 DLOG(WARNING) << "activation failed hr=" << hr;
426 return hr; 427 return hr;
427 } 428 }
428 429
429 // Create the IPC channel IO thread. It needs to out-live the ChannelProxy. 430 // Create the IPC channel IO thread. It needs to out-live the ChannelProxy.
430 base::Thread io_thread("metro_IO_thread"); 431 base::Thread io_thread("metro_IO_thread");
431 base::Thread::Options options; 432 base::Thread::Options options;
432 options.message_loop_type = base::MessageLoop::TYPE_IO; 433 options.message_loop_type = base::MessageLoop::TYPE_IO;
433 io_thread.StartWithOptions(options); 434 io_thread.StartWithOptions(options);
434 435
435 std::string ipc_channel_name("viewer");
436
437 // TODO(robertshield): Figure out how to receive and append the channel ID
438 // from the delegate_execute instance that launched the browser process.
439 // See http://crbug.com/162474
440 // ipc_channel_name.append(IPC::Channel::GenerateUniqueRandomChannelID());
441
442 // Start up Chrome and wait for the desired IPC server connection to exist. 436 // Start up Chrome and wait for the desired IPC server connection to exist.
443 WaitForChromeIPCConnection(ipc_channel_name); 437 WaitForChromeIPCConnection(win8::kMetroViewerIPCChannelName);
444 438
445 // In Aura mode we create an IPC channel to the browser, then ask it to 439 // In Aura mode we create an IPC channel to the browser, then ask it to
446 // connect to us. 440 // connect to us.
447 ChromeChannelListener ui_channel_listener(&ui_loop_, this); 441 ChromeChannelListener ui_channel_listener(&ui_loop_, this);
448 IPC::ChannelProxy ui_channel(ipc_channel_name, 442 IPC::ChannelProxy ui_channel(win8::kMetroViewerIPCChannelName,
449 IPC::Channel::MODE_NAMED_CLIENT, 443 IPC::Channel::MODE_NAMED_CLIENT,
450 &ui_channel_listener, 444 &ui_channel_listener,
451 io_thread.message_loop_proxy()); 445 io_thread.message_loop_proxy());
452 ui_channel_ = &ui_channel; 446 ui_channel_ = &ui_channel;
453 447
454 // Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the 448 // Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the
455 // browser will use D3D from the browser process to present to our Window. 449 // browser will use D3D from the browser process to present to our Window.
456 ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface( 450 ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface(
457 gfx::NativeViewId(core_window_hwnd_))); 451 gfx::NativeViewId(core_window_hwnd_)));
458 DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_; 452 DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_;
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; 951 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit;
958 CheckHR(core_app.As(&app_exit)); 952 CheckHR(core_app.As(&app_exit));
959 globals.app_exit = app_exit.Detach(); 953 globals.app_exit = app_exit.Detach();
960 } 954 }
961 955
962 IFACEMETHODIMP 956 IFACEMETHODIMP
963 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { 957 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) {
964 *view = mswr::Make<ChromeAppViewAsh>().Detach(); 958 *view = mswr::Make<ChromeAppViewAsh>().Detach();
965 return (*view) ? S_OK : E_OUTOFMEMORY; 959 return (*view) ? S_OK : E_OUTOFMEMORY;
966 } 960 }
OLDNEW
« no previous file with comments | « win8/delegate_execute/command_execute_impl.cc ('k') | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698