| 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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| 5 | 5 |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 ExtensionService* service = profile->GetExtensionService(); | 442 ExtensionService* service = profile->GetExtensionService(); |
| 443 if (!service) | 443 if (!service) |
| 444 return; | 444 return; |
| 445 | 445 |
| 446 const extensions::Extension* extension = | 446 const extensions::Extension* extension = |
| 447 service->GetExtensionById(kFileBrowserDomain, false); | 447 service->GetExtensionById(kFileBrowserDomain, false); |
| 448 if (!extension) | 448 if (!extension) |
| 449 return; | 449 return; |
| 450 | 450 |
| 451 content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); | 451 content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); |
| 452 application_launch::OpenApplication(profile, extension, | 452 application_launch::LaunchParams params(profile, extension, |
| 453 extension_misc::LAUNCH_WINDOW, GURL(url), NEW_FOREGROUND_TAB, NULL); | 453 extension_misc::LAUNCH_WINDOW, |
| 454 NEW_FOREGROUND_TAB); |
| 455 params.override_url = GURL(url); |
| 456 application_launch::OpenApplication(params); |
| 454 } | 457 } |
| 455 | 458 |
| 456 void ViewRemovableDrive(const FilePath& path) { | 459 void ViewRemovableDrive(const FilePath& path) { |
| 457 OpenFileBrowser(path, REUSE_ANY_FILE_MANAGER, "mountTriggered"); | 460 OpenFileBrowser(path, REUSE_ANY_FILE_MANAGER, "mountTriggered"); |
| 458 } | 461 } |
| 459 | 462 |
| 460 void ShowFileInFolder(const FilePath& path) { | 463 void ShowFileInFolder(const FilePath& path) { |
| 461 // This action changes the selection so we do not reuse existing tabs. | 464 // This action changes the selection so we do not reuse existing tabs. |
| 462 OpenFileBrowser(path, REUSE_NEVER, "selectOnly"); | 465 OpenFileBrowser(path, REUSE_NEVER, "selectOnly"); |
| 463 } | 466 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 640 |
| 638 ExtensionService* service = profile->GetExtensionService(); | 641 ExtensionService* service = profile->GetExtensionService(); |
| 639 if (!service) | 642 if (!service) |
| 640 return false; | 643 return false; |
| 641 | 644 |
| 642 const extensions::Extension* extension = | 645 const extensions::Extension* extension = |
| 643 service->GetExtensionById(kFileBrowserDomain, false); | 646 service->GetExtensionById(kFileBrowserDomain, false); |
| 644 if (!extension) | 647 if (!extension) |
| 645 return false; | 648 return false; |
| 646 | 649 |
| 647 application_launch::OpenApplication( | 650 application_launch::LaunchParams params(profile, extension, |
| 648 profile, extension, extension_misc::LAUNCH_WINDOW, | 651 extension_misc::LAUNCH_WINDOW, |
| 649 GetVideoPlayerUrl(url), NEW_FOREGROUND_TAB, NULL); | 652 NEW_FOREGROUND_TAB); |
| 653 params.override_url = GetVideoPlayerUrl(url); |
| 654 application_launch::OpenApplication(params); |
| 650 return true; | 655 return true; |
| 651 } | 656 } |
| 652 | 657 |
| 653 if (IsCRXFile(file_extension.data())) { | 658 if (IsCRXFile(file_extension.data())) { |
| 654 InstallCRX(browser, path); | 659 InstallCRX(browser, path); |
| 655 return true; | 660 return true; |
| 656 } | 661 } |
| 657 | 662 |
| 658 // Unknown file type. Record UMA and show an error message. | 663 // Unknown file type. Record UMA and show an error message. |
| 659 size_t extension_index = UMAExtensionIndex(file_extension.data(), | 664 size_t extension_index = UMAExtensionIndex(file_extension.data(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 GDataOperationRegistry::ProgressStatus>::const_iterator iter = | 710 GDataOperationRegistry::ProgressStatus>::const_iterator iter = |
| 706 list.begin(); | 711 list.begin(); |
| 707 iter != list.end(); ++iter) { | 712 iter != list.end(); ++iter) { |
| 708 result_list->Append( | 713 result_list->Append( |
| 709 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 714 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
| 710 } | 715 } |
| 711 return result_list.release(); | 716 return result_list.release(); |
| 712 } | 717 } |
| 713 | 718 |
| 714 } // namespace file_manager_util | 719 } // namespace file_manager_util |
| OLD | NEW |