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/file_manager_util.h" | 4 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" |
5 | 5 |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 515 } |
516 | 516 |
517 GURL GetFileBrowserUrl() { | 517 GURL GetFileBrowserUrl() { |
518 return GetFileManagerUrl("/main.html"); | 518 return GetFileManagerUrl("/main.html"); |
519 } | 519 } |
520 | 520 |
521 GURL GetMediaPlayerUrl() { | 521 GURL GetMediaPlayerUrl() { |
522 return GetFileManagerUrl("/mediaplayer.html"); | 522 return GetFileManagerUrl("/mediaplayer.html"); |
523 } | 523 } |
524 | 524 |
525 GURL GetVideoPlayerUrl(const GURL& source_url) { | |
526 return GURL(GetFileManagerUrl("/video_player.html").spec() + | |
527 std::string("?") + source_url.spec()); | |
528 } | |
529 | |
530 GURL GetActionChoiceUrl(const base::FilePath& virtual_path, | 525 GURL GetActionChoiceUrl(const base::FilePath& virtual_path, |
531 bool advanced_mode) { | 526 bool advanced_mode) { |
532 std::string url = GetFileManagerUrl("/action_choice.html").spec(); | 527 std::string url = GetFileManagerUrl("/action_choice.html").spec(); |
533 if (advanced_mode) | 528 if (advanced_mode) |
534 url += "?advanced-mode"; | 529 url += "?advanced-mode"; |
535 url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), | 530 url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), |
536 false); // Space to %20 instead of +. | 531 false); // Space to %20 instead of +. |
537 return GURL(url); | 532 return GURL(url); |
538 } | 533 } |
539 | 534 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 NOTREACHED(); | 676 NOTREACHED(); |
682 } | 677 } |
683 | 678 |
684 return title; | 679 return title; |
685 } | 680 } |
686 | 681 |
687 void ViewRemovableDrive(const base::FilePath& path) { | 682 void ViewRemovableDrive(const base::FilePath& path) { |
688 OpenFileBrowserImpl(path, "auto-open"); | 683 OpenFileBrowserImpl(path, "auto-open"); |
689 } | 684 } |
690 | 685 |
691 void OpenNewWindow(Profile* profile, const GURL& url) { | |
692 ExtensionService* service = extensions::ExtensionSystem::Get( | |
693 profile ? profile : ProfileManager::GetDefaultProfileOrOffTheRecord())-> | |
694 extension_service(); | |
695 if (!service) | |
696 return; | |
697 | |
698 const extensions::Extension* extension = | |
699 service->GetExtensionById(kFileBrowserDomain, false); | |
700 if (!extension) | |
701 return; | |
702 | |
703 chrome::AppLaunchParams params(profile, extension, | |
704 extension_misc::LAUNCH_WINDOW, | |
705 NEW_FOREGROUND_TAB); | |
706 params.override_url = url; | |
707 chrome::OpenApplication(params); | |
708 } | |
709 | |
710 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode) { | 686 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode) { |
711 const int kDialogWidth = 394; | 687 const int kDialogWidth = 394; |
712 // TODO(dgozman): remove 50, which is a title height once popup window | 688 // TODO(dgozman): remove 50, which is a title height once popup window |
713 // will have no title. | 689 // will have no title. |
714 const int kDialogHeight = 316 + 50; | 690 const int kDialogHeight = 316 + 50; |
715 | 691 |
716 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 692 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
717 | 693 |
718 base::FilePath virtual_path; | 694 base::FilePath virtual_path; |
719 if (!ConvertFileToRelativeFileSystemPath(profile, kFileBrowserDomain, path, | 695 if (!ConvertFileToRelativeFileSystemPath(profile, kFileBrowserDomain, path, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 // determined, then indicate that it has the empty mime-type. This will | 842 // determined, then indicate that it has the empty mime-type. This will |
867 // only be matched if the Web Intents accepts "*" or "*/*". | 843 // only be matched if the Web Intents accepts "*" or "*/*". |
868 return ""; | 844 return ""; |
869 } else { | 845 } else { |
870 return mime_type; | 846 return mime_type; |
871 } | 847 } |
872 } | 848 } |
873 | 849 |
874 } // namespace util | 850 } // namespace util |
875 } // namespace file_manager | 851 } // namespace file_manager |
OLD | NEW |