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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/chromeos/extensions/file_handler_util.h" | 16 #include "chrome/browser/chromeos/extensions/file_handler_util.h" |
17 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 17 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
18 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
19 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
20 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 20 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
21 #include "chrome/browser/extensions/crx_installer.h" | 21 #include "chrome/browser/extensions/crx_installer.h" |
22 #include "chrome/browser/extensions/extension_install_ui.h" | 22 #include "chrome/browser/extensions/extension_install_prompt.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/plugin_prefs.h" | 24 #include "chrome/browser/plugin_prefs.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
29 #include "chrome/browser/ui/browser_list.h" | 29 #include "chrome/browser/ui/browser_list.h" |
30 #include "chrome/browser/ui/browser_window.h" | 30 #include "chrome/browser/ui/browser_window.h" |
31 #include "chrome/browser/ui/simple_message_box.h" | 31 #include "chrome/browser/ui/simple_message_box.h" |
32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 arraysize(kUMATrackingExtensions) - 1); | 685 arraysize(kUMATrackingExtensions) - 1); |
686 return false; | 686 return false; |
687 } | 687 } |
688 | 688 |
689 void InstallCRX(Profile* profile, const FilePath& path) { | 689 void InstallCRX(Profile* profile, const FilePath& path) { |
690 ExtensionService* service = profile->GetExtensionService(); | 690 ExtensionService* service = profile->GetExtensionService(); |
691 CHECK(service); | 691 CHECK(service); |
692 if (!service) | 692 if (!service) |
693 return; | 693 return; |
694 | 694 |
695 scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service, | 695 scoped_refptr<CrxInstaller> installer( |
696 new ExtensionInstallUI(profile))); | 696 CrxInstaller::Create(service, new ExtensionInstallPrompt(profile))); |
697 installer->set_is_gallery_install(false); | 697 installer->set_is_gallery_install(false); |
698 installer->set_allow_silent_install(false); | 698 installer->set_allow_silent_install(false); |
699 installer->InstallCrx(path); | 699 installer->InstallCrx(path); |
700 } | 700 } |
701 | 701 |
702 // If pdf plugin is enabled, we should open pdf files in a tab. | 702 // If pdf plugin is enabled, we should open pdf files in a tab. |
703 bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension) { | 703 bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension) { |
704 if (base::strcasecmp(file_extension, kPdfExtension) != 0) | 704 if (base::strcasecmp(file_extension, kPdfExtension) != 0) |
705 return false; | 705 return false; |
706 | 706 |
(...skipping 19 matching lines...) Expand all Loading... |
726 GDataOperationRegistry::ProgressStatus>::const_iterator iter = | 726 GDataOperationRegistry::ProgressStatus>::const_iterator iter = |
727 list.begin(); | 727 list.begin(); |
728 iter != list.end(); ++iter) { | 728 iter != list.end(); ++iter) { |
729 result_list->Append( | 729 result_list->Append( |
730 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 730 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
731 } | 731 } |
732 return result_list.release(); | 732 return result_list.release(); |
733 } | 733 } |
734 | 734 |
735 } // namespace file_manager_util | 735 } // namespace file_manager_util |
OLD | NEW |