OLD | NEW |
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 DCHECK(file_path_.IsAbsolute()); | 128 DCHECK(file_path_.IsAbsolute()); |
129 | 129 |
130 if (HasFileSystemWritePermission(extension_)) { | 130 if (HasFileSystemWritePermission(extension_)) { |
131 std::vector<base::FilePath> paths; | 131 std::vector<base::FilePath> paths; |
132 paths.push_back(file_path_); | 132 paths.push_back(file_path_); |
133 CheckWritableFiles( | 133 CheckWritableFiles( |
134 paths, | 134 paths, |
135 profile_, | 135 profile_, |
| 136 false, |
136 base::Bind(&PlatformAppPathLauncher::OnFileValid, this), | 137 base::Bind(&PlatformAppPathLauncher::OnFileValid, this), |
137 base::Bind(&PlatformAppPathLauncher::OnFileInvalid, this)); | 138 base::Bind(&PlatformAppPathLauncher::OnFileInvalid, this)); |
138 return; | 139 return; |
139 } | 140 } |
140 | 141 |
141 OnFileValid(); | 142 OnFileValid(); |
142 } | 143 } |
143 | 144 |
144 void LaunchWithHandler(const std::string& handler_id) { | 145 void LaunchWithHandler(const std::string& handler_id) { |
145 handler_id_ = handler_id; | 146 handler_id_ = handler_id; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 277 } |
277 | 278 |
278 void GrantAccessToFileAndLaunch(const std::string& mime_type, | 279 void GrantAccessToFileAndLaunch(const std::string& mime_type, |
279 ExtensionHost* host) { | 280 ExtensionHost* host) { |
280 // If there was an error loading the app page, |host| will be NULL. | 281 // If there was an error loading the app page, |host| will be NULL. |
281 if (!host) { | 282 if (!host) { |
282 LOG(ERROR) << "Could not load app page for " << extension_->id(); | 283 LOG(ERROR) << "Could not load app page for " << extension_->id(); |
283 return; | 284 return; |
284 } | 285 } |
285 | 286 |
286 GrantedFileEntry file_entry = CreateFileEntry( | 287 GrantedFileEntry file_entry = |
287 profile_, extension_, host->render_process_host()->GetID(), file_path_); | 288 CreateFileEntry(profile_, |
| 289 extension_, |
| 290 host->render_process_host()->GetID(), |
| 291 file_path_, |
| 292 false); |
288 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry( | 293 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
289 profile_, extension_, handler_id_, mime_type, file_entry); | 294 profile_, extension_, handler_id_, mime_type, file_entry); |
290 } | 295 } |
291 | 296 |
292 // The profile the app should be run in. | 297 // The profile the app should be run in. |
293 Profile* profile_; | 298 Profile* profile_; |
294 // The extension providing the app. | 299 // The extension providing the app. |
295 const Extension* extension_; | 300 const Extension* extension_; |
296 // The path to be passed through to the app. | 301 // The path to be passed through to the app. |
297 const base::FilePath file_path_; | 302 const base::FilePath file_path_; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 extension_prefs->SetIsActive(extension->id(), false); | 381 extension_prefs->SetIsActive(extension->id(), false); |
377 bool listening_to_launch = event_router-> | 382 bool listening_to_launch = event_router-> |
378 ExtensionHasEventListener(extension->id(), | 383 ExtensionHasEventListener(extension->id(), |
379 app_runtime::OnLaunched::kEventName); | 384 app_runtime::OnLaunched::kEventName); |
380 | 385 |
381 if (listening_to_launch && had_windows) | 386 if (listening_to_launch && had_windows) |
382 LaunchPlatformAppWithNoData(profile, extension); | 387 LaunchPlatformAppWithNoData(profile, extension); |
383 } | 388 } |
384 | 389 |
385 } // namespace apps | 390 } // namespace apps |
OLD | NEW |