| 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 "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h" |
| 6 | 6 |
| 7 #include "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (params->item_id.empty()) | 256 if (params->item_id.empty()) |
| 257 return false; | 257 return false; |
| 258 | 258 |
| 259 const extensions::WebstoreStandaloneInstaller::Callback callback = | 259 const extensions::WebstoreStandaloneInstaller::Callback callback = |
| 260 base::Bind( | 260 base::Bind( |
| 261 &FileBrowserPrivateInstallWebstoreItemFunction::OnInstallComplete, | 261 &FileBrowserPrivateInstallWebstoreItemFunction::OnInstallComplete, |
| 262 this); | 262 this); |
| 263 | 263 |
| 264 scoped_refptr<file_manager::AppInstaller> installer( | 264 scoped_refptr<file_manager::AppInstaller> installer( |
| 265 new file_manager::AppInstaller( | 265 new file_manager::AppInstaller( |
| 266 GetAssociatedWebContents(), // web_contents(), | 266 GetAssociatedWebContents(), |
| 267 params->item_id, | 267 params->item_id, |
| 268 GetProfile(), | 268 GetProfile(), |
| 269 callback)); | 269 callback)); |
| 270 // installer will be AddRef()'d in BeginInstall(). | 270 // installer will be AddRef()'d in BeginInstall(). |
| 271 installer->BeginInstall(); | 271 installer->BeginInstall(); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 void FileBrowserPrivateInstallWebstoreItemFunction::OnInstallComplete( | 275 void FileBrowserPrivateInstallWebstoreItemFunction::OnInstallComplete( |
| 276 bool success, | 276 bool success, |
| 277 const std::string& error) { | 277 const std::string& error) { |
| 278 if (success) { | 278 if (success) { |
| 279 drive::util::Log(logging::LOG_INFO, | 279 drive::util::Log(logging::LOG_INFO, |
| 280 "App install succeeded. (item id: %s)", | 280 "App install succeeded. (item id: %s)", |
| 281 webstore_item_id_.c_str()); | 281 webstore_item_id_.c_str()); |
| 282 } else { | 282 } else { |
| 283 drive::util::Log(logging::LOG_ERROR, | 283 drive::util::Log(logging::LOG_ERROR, |
| 284 "App install failed. (item id: %s, reason: %s)", | 284 "App install failed. (item id: %s, reason: %s)", |
| 285 webstore_item_id_.c_str(), | 285 webstore_item_id_.c_str(), |
| 286 error.c_str()); | 286 error.c_str()); |
| 287 error_ = error; | 287 SetError(error); |
| 288 } | 288 } |
| 289 | 289 |
| 290 SendResponse(success); | 290 SendResponse(success); |
| 291 } | 291 } |
| 292 | 292 |
| 293 FileBrowserPrivateRequestWebStoreAccessTokenFunction:: | 293 FileBrowserPrivateRequestWebStoreAccessTokenFunction:: |
| 294 FileBrowserPrivateRequestWebStoreAccessTokenFunction() { | 294 FileBrowserPrivateRequestWebStoreAccessTokenFunction() { |
| 295 } | 295 } |
| 296 | 296 |
| 297 FileBrowserPrivateRequestWebStoreAccessTokenFunction:: | 297 FileBrowserPrivateRequestWebStoreAccessTokenFunction:: |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 shell_window->GetNativeWindow(), | 413 shell_window->GetNativeWindow(), |
| 414 params->profile_id)) { | 414 params->profile_id)) { |
| 415 SetError("The window cannot visit the desktop."); | 415 SetError("The window cannot visit the desktop."); |
| 416 return false; | 416 return false; |
| 417 } | 417 } |
| 418 | 418 |
| 419 return true; | 419 return true; |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace extensions | 422 } // namespace extensions |
| OLD | NEW |