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_ui.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" | |
30 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
31 #include "chrome/browser/ui/simple_message_box.h" | 30 #include "chrome/browser/ui/simple_message_box.h" |
32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
33 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 32 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
34 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/extensions/file_browser_handler.h" | 34 #include "chrome/common/extensions/file_browser_handler.h" |
36 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
37 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/plugin_service.h" | 37 #include "content/public/browser/plugin_service.h" |
39 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 432 |
434 return false; | 433 return false; |
435 } | 434 } |
436 | 435 |
437 void OpenFileBrowser(const FilePath& path, | 436 void OpenFileBrowser(const FilePath& path, |
438 TAB_REUSE_MODE mode, | 437 TAB_REUSE_MODE mode, |
439 const std::string& flag_name) { | 438 const std::string& flag_name) { |
440 if (FileManageTabExists(path, mode)) | 439 if (FileManageTabExists(path, mode)) |
441 return; | 440 return; |
442 | 441 |
443 Browser* last_active = BrowserList::GetLastActive(); | 442 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
444 Profile* profile = last_active ? last_active->profile() : | |
445 ProfileManager::GetDefaultProfileOrOffTheRecord(); | |
446 | 443 |
447 std::string url = chrome::kChromeUIFileManagerURL; | 444 std::string url = chrome::kChromeUIFileManagerURL; |
448 if (flag_name.size()) { | 445 if (flag_name.size()) { |
449 DictionaryValue arg_value; | 446 DictionaryValue arg_value; |
450 arg_value.SetBoolean(flag_name, "true"); | 447 arg_value.SetBoolean(flag_name, "true"); |
451 std::string query; | 448 std::string query; |
452 base::JSONWriter::Write(&arg_value, &query); | 449 base::JSONWriter::Write(&arg_value, &query); |
453 url += "?" + net::EscapeUrlEncodedData(query, false); | 450 url += "?" + net::EscapeUrlEncodedData(query, false); |
454 } | 451 } |
455 if (!path.empty()) { | 452 if (!path.empty()) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 GDataOperationRegistry::ProgressStatus>::const_iterator iter = | 723 GDataOperationRegistry::ProgressStatus>::const_iterator iter = |
727 list.begin(); | 724 list.begin(); |
728 iter != list.end(); ++iter) { | 725 iter != list.end(); ++iter) { |
729 result_list->Append( | 726 result_list->Append( |
730 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 727 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
731 } | 728 } |
732 return result_list.release(); | 729 return result_list.release(); |
733 } | 730 } |
734 | 731 |
735 } // namespace file_manager_util | 732 } // namespace file_manager_util |
OLD | NEW |