| OLD | NEW |
| 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 "chrome/browser/extensions/platform_app_launcher.h" | 5 #include "chrome/browser/extensions/platform_app_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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // An instance of this class is created for each launch. The lifetime of these | 100 // An instance of this class is created for each launch. The lifetime of these |
| 101 // instances is managed by reference counted pointers. As long as an instance | 101 // instances is managed by reference counted pointers. As long as an instance |
| 102 // has outstanding tasks on a message queue it will be retained; once all | 102 // has outstanding tasks on a message queue it will be retained; once all |
| 103 // outstanding tasks are completed it will be deleted. | 103 // outstanding tasks are completed it will be deleted. |
| 104 class PlatformAppPathLauncher | 104 class PlatformAppPathLauncher |
| 105 : public base::RefCountedThreadSafe<PlatformAppPathLauncher> { | 105 : public base::RefCountedThreadSafe<PlatformAppPathLauncher> { |
| 106 public: | 106 public: |
| 107 PlatformAppPathLauncher(Profile* profile, | 107 PlatformAppPathLauncher(Profile* profile, |
| 108 const Extension* extension, | 108 const Extension* extension, |
| 109 const base::FilePath& file_path) | 109 const base::FilePath& file_path) |
| 110 : profile_(profile), | 110 : profile_(profile), extension_(extension), file_path_(file_path) {} |
| 111 extension_(extension), | |
| 112 file_path_(file_path), | |
| 113 handler_id_("") {} | |
| 114 | 111 |
| 115 void Launch() { | 112 void Launch() { |
| 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 117 if (file_path_.empty()) { | 114 if (file_path_.empty()) { |
| 118 LaunchPlatformAppWithNoData(profile_, extension_); | 115 LaunchPlatformAppWithNoData(profile_, extension_); |
| 119 return; | 116 return; |
| 120 } | 117 } |
| 121 | 118 |
| 122 DCHECK(file_path_.IsAbsolute()); | 119 DCHECK(file_path_.IsAbsolute()); |
| 123 | 120 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 void RestartPlatformAppWithFileEntries( | 417 void RestartPlatformAppWithFileEntries( |
| 421 Profile* profile, | 418 Profile* profile, |
| 422 const Extension* extension, | 419 const Extension* extension, |
| 423 const std::vector<SavedFileEntry>& file_entries) { | 420 const std::vector<SavedFileEntry>& file_entries) { |
| 424 scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( | 421 scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( |
| 425 profile, extension, file_entries); | 422 profile, extension, file_entries); |
| 426 launcher->Launch(); | 423 launcher->Launch(); |
| 427 } | 424 } |
| 428 | 425 |
| 429 } // namespace extensions | 426 } // namespace extensions |
| OLD | NEW |