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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 private: | 140 private: |
141 friend class base::RefCountedThreadSafe<PlatformAppPathLauncher>; | 141 friend class base::RefCountedThreadSafe<PlatformAppPathLauncher>; |
142 | 142 |
143 virtual ~PlatformAppPathLauncher() {} | 143 virtual ~PlatformAppPathLauncher() {} |
144 | 144 |
145 void GetMimeTypeAndLaunch() { | 145 void GetMimeTypeAndLaunch() { |
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
147 | 147 |
148 // If the file doesn't exist, or is a directory, launch with no launch data. | 148 // If the file doesn't exist, or is a directory, launch with no launch data. |
149 if (!base::PathExists(file_path_) || | 149 if (!base::PathExists(file_path_) || |
150 file_util::DirectoryExists(file_path_)) { | 150 base::DirectoryExists(file_path_)) { |
151 LOG(WARNING) << "No file exists with path " << file_path_.value(); | 151 LOG(WARNING) << "No file exists with path " << file_path_.value(); |
152 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 152 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
153 &PlatformAppPathLauncher::LaunchWithNoLaunchData, this)); | 153 &PlatformAppPathLauncher::LaunchWithNoLaunchData, this)); |
154 return; | 154 return; |
155 } | 155 } |
156 | 156 |
157 std::string mime_type; | 157 std::string mime_type; |
158 if (!net::GetMimeTypeFromFile(file_path_, &mime_type)) | 158 if (!net::GetMimeTypeFromFile(file_path_, &mime_type)) |
159 mime_type = kFallbackMimeType; | 159 mime_type = kFallbackMimeType; |
160 | 160 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 bool had_windows = extension_prefs->IsActive(extension->id()); | 346 bool had_windows = extension_prefs->IsActive(extension->id()); |
347 extension_prefs->SetIsActive(extension->id(), false); | 347 extension_prefs->SetIsActive(extension->id(), false); |
348 bool listening_to_launch = event_router-> | 348 bool listening_to_launch = event_router-> |
349 ExtensionHasEventListener(extension->id(), event_names::kOnLaunched); | 349 ExtensionHasEventListener(extension->id(), event_names::kOnLaunched); |
350 | 350 |
351 if (listening_to_launch && had_windows) | 351 if (listening_to_launch && had_windows) |
352 LaunchPlatformAppWithNoData(profile, extension); | 352 LaunchPlatformAppWithNoData(profile, extension); |
353 } | 353 } |
354 | 354 |
355 } // namespace extensions | 355 } // namespace extensions |
OLD | NEW |