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

Side by Side Diff: apps/app_shim/app_shim_host_manager_mac.mm

Issue 15269003: Refactor extension handling code from AppShimHost into ExtensionAppShimHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/app_shim/app_shim_host_manager_mac.h" 5 #include "apps/app_shim/app_shim_host_manager_mac.h"
6 6
7 #include "apps/app_shim/app_shim_handler_mac.h"
7 #include "apps/app_shim/app_shim_host_mac.h" 8 #include "apps/app_shim/app_shim_host_mac.h"
8 #include "base/bind.h" 9 #include "base/bind.h"
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
13 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "chrome/common/mac/app_mode_common.h" 16 #include "chrome/common/mac/app_mode_common.h"
16 17
17 using content::BrowserThread; 18 using content::BrowserThread;
18 19
19 namespace { 20 namespace {
20 21
21 void CreateAppShimHost(const IPC::ChannelHandle& handle) { 22 void CreateAppShimHost(const IPC::ChannelHandle& handle) {
22 // AppShimHost takes ownership of itself. 23 // AppShimHost takes ownership of itself.
23 (new AppShimHost)->ServeChannel(handle); 24 (new AppShimHost)->ServeChannel(handle);
24 } 25 }
25 26
26 } // namespace 27 } // namespace
27 28
28 AppShimHostManager::AppShimHostManager() { 29 AppShimHostManager::AppShimHostManager() {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
31 apps::AppShimHandler::SetDefaultHandler(&extension_app_shim_handler_);
30 BrowserThread::PostTask( 32 BrowserThread::PostTask(
31 BrowserThread::FILE, FROM_HERE, 33 BrowserThread::FILE, FROM_HERE,
32 base::Bind(&AppShimHostManager::InitOnFileThread, 34 base::Bind(&AppShimHostManager::InitOnFileThread,
33 base::Unretained(this))); 35 base::Unretained(this)));
34 } 36 }
35 37
36 AppShimHostManager::~AppShimHostManager() { 38 AppShimHostManager::~AppShimHostManager() {
39 apps::AppShimHandler::SetDefaultHandler(NULL);
37 } 40 }
38 41
39 void AppShimHostManager::InitOnFileThread() { 42 void AppShimHostManager::InitOnFileThread() {
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
41 base::FilePath user_data_dir; 44 base::FilePath user_data_dir;
42 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { 45 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
43 LOG(ERROR) << "Couldn't get user data directory while creating App Shim " 46 LOG(ERROR) << "Couldn't get user data directory while creating App Shim "
44 << "Host manager."; 47 << "Host manager.";
45 return; 48 return;
46 } 49 }
(...skipping 15 matching lines...) Expand all
62 const IPC::ChannelHandle& handle) { 65 const IPC::ChannelHandle& handle) {
63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
64 BrowserThread::PostTask( 67 BrowserThread::PostTask(
65 BrowserThread::UI, FROM_HERE, 68 BrowserThread::UI, FROM_HERE,
66 base::Bind(&CreateAppShimHost, handle)); 69 base::Bind(&CreateAppShimHost, handle));
67 } 70 }
68 71
69 void AppShimHostManager::OnListenError() { 72 void AppShimHostManager::OnListenError() {
70 // TODO(jeremya): set a timeout and attempt to reconstruct the channel. 73 // TODO(jeremya): set a timeout and attempt to reconstruct the channel.
71 } 74 }
OLDNEW
« no previous file with comments | « apps/app_shim/app_shim_host_manager_mac.h ('k') | apps/app_shim/extension_app_shim_handler_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698