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

Side by Side Diff: apps/launcher.cc

Issue 23739005: Replace direct use of DriveIntegrationServiceFactory with drive::util::GetFileSystemByProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « no previous file | 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
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/launcher.h" 5 #include "apps/launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/common/extensions/api/app_runtime.h" 26 #include "chrome/common/extensions/api/app_runtime.h"
27 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
28 #include "chrome/common/extensions/extension_messages.h" 28 #include "chrome/common/extensions/extension_messages.h"
29 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/render_process_host.h" 30 #include "content/public/browser/render_process_host.h"
31 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
32 #include "net/base/mime_util.h" 32 #include "net/base/mime_util.h"
33 #include "net/base/net_util.h" 33 #include "net/base/net_util.h"
34 34
35 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
36 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
37 #include "chrome/browser/chromeos/drive/file_errors.h" 36 #include "chrome/browser/chromeos/drive/file_errors.h"
38 #include "chrome/browser/chromeos/drive/file_system_interface.h" 37 #include "chrome/browser/chromeos/drive/file_system_interface.h"
39 #include "chrome/browser/chromeos/drive/file_system_util.h" 38 #include "chrome/browser/chromeos/drive/file_system_util.h"
40 #endif 39 #endif
41 40
42 #if defined(OS_WIN) 41 #if defined(OS_WIN)
43 #include "win8/util/win8_util.h" 42 #include "win8/util/win8_util.h"
44 #endif 43 #endif
45 44
46 namespace app_runtime = extensions::api::app_runtime; 45 namespace app_runtime = extensions::api::app_runtime;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 mime_type = kFallbackMimeType; 186 mime_type = kFallbackMimeType;
188 187
189 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( 188 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
190 &PlatformAppPathLauncher::LaunchWithMimeType, this, mime_type)); 189 &PlatformAppPathLauncher::LaunchWithMimeType, this, mime_type));
191 } 190 }
192 191
193 #if defined(OS_CHROMEOS) 192 #if defined(OS_CHROMEOS)
194 void GetMimeTypeAndLaunchForDriveFile() { 193 void GetMimeTypeAndLaunchForDriveFile() {
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
196 195
197 drive::DriveIntegrationService* service = 196 drive::FileSystemInterface* file_system =
198 drive::DriveIntegrationServiceFactory::FindForProfile(profile_); 197 drive::util::GetFileSystemByProfile(profile_);
199 if (!service) { 198 if (!file_system) {
200 LaunchWithNoLaunchData(); 199 LaunchWithNoLaunchData();
201 return; 200 return;
202 } 201 }
203 202
204 service->file_system()->GetFileByPath( 203 file_system->GetFileByPath(
205 drive::util::ExtractDrivePath(file_path_), 204 drive::util::ExtractDrivePath(file_path_),
206 base::Bind(&PlatformAppPathLauncher::OnGotDriveFile, this)); 205 base::Bind(&PlatformAppPathLauncher::OnGotDriveFile, this));
207 } 206 }
208 207
209 void OnGotDriveFile(drive::FileError error, 208 void OnGotDriveFile(drive::FileError error,
210 const base::FilePath& file_path, 209 const base::FilePath& file_path,
211 scoped_ptr<drive::ResourceEntry> entry) { 210 scoped_ptr<drive::ResourceEntry> entry) {
212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
213 212
214 if (error != drive::FILE_ERROR_OK || 213 if (error != drive::FILE_ERROR_OK ||
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 extension_prefs->SetIsActive(extension->id(), false); 380 extension_prefs->SetIsActive(extension->id(), false);
382 bool listening_to_launch = event_router-> 381 bool listening_to_launch = event_router->
383 ExtensionHasEventListener(extension->id(), 382 ExtensionHasEventListener(extension->id(),
384 app_runtime::OnLaunched::kEventName); 383 app_runtime::OnLaunched::kEventName);
385 384
386 if (listening_to_launch && had_windows) 385 if (listening_to_launch && had_windows)
387 LaunchPlatformAppWithNoData(profile, extension); 386 LaunchPlatformAppWithNoData(profile, extension);
388 } 387 }
389 388
390 } // namespace apps 389 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698