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

Side by Side Diff: ui/viewer/viewer_process.cc

Issue 10872002: beginnings of metro viewer process (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 years, 3 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 | « ui/viewer/viewer_process.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/viewer/viewer_process.h"
6
7 #include "ui/viewer/viewer_ipc_server.h"
8 #include "ui/viewer/viewer_host_win.h"
9
10 ViewerProcess* g_viewer_process = NULL;
11
12 ViewerProcess::ViewerProcess()
13 : shutdown_event_(true, false),
14 main_message_loop_(NULL) {
15 DCHECK(!g_viewer_process);
16 g_viewer_process = this;
17 }
18
19 ViewerProcess::~ViewerProcess() {
20 Teardown();
21 g_viewer_process = NULL;
22 }
23
24 bool ViewerProcess::Initialize(MessageLoop* message_loop,
25 const CommandLine& command_line) {
26 main_message_loop_ = message_loop;
27
28 base::Thread::Options options;
29 options.message_loop_type = MessageLoop::TYPE_IO;
30 io_thread_.reset(new base::Thread("ViewerProcess_IO"));
31 if (!io_thread_->StartWithOptions(options)) {
32 NOTREACHED();
33 Teardown();
34 return false;
35 }
36
37 VLOG(1) << "Starting Viewer Process IPC Server";
38 // TODO(scottmg): Channel name should be per user-data-dir.
39 ipc_server_.reset(new ViewerIPCServer("viewer_ipc"));
40 ipc_server_->Init();
41
42 // TODO(scottmg): I guess the whole thing should be made Windows-only at
43 // some point.
44 #if defined(OS_WIN)
45 viewer_host_win_.reset(new ViewerHostWin);
46 #endif
47
48 // TODO(scottmg): Ask for a handle here, maybe start a browser, all that
49 // jazz.
50
51 return true;
52 }
53
54 bool ViewerProcess::Teardown() {
55 ipc_server_.reset();
56 io_thread_.reset();
57 return true;
58 }
59
60 bool ViewerProcess::HandleClientDisconnect() {
61 Terminate();
62 return false;
63 }
64
65 void ViewerProcess::Terminate() {
66 main_message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
67 }
OLDNEW
« no previous file with comments | « ui/viewer/viewer_process.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698