| 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 | 4 |
| 5 #include "chrome/browser/chromeos/file_manager/url_util.h" | 5 #include "chrome/browser/chromeos/file_manager/url_util.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/file_manager/app_id.h" | 9 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 // If the caller cannot handle Drive path, the file chooser dialog need to | 108 // If the caller cannot handle Drive path, the file chooser dialog need to |
| 109 // return resolved local native paths to the selected files. | 109 // return resolved local native paths to the selected files. |
| 110 arg_value.SetBoolean("shouldReturnLocalPath", | 110 arg_value.SetBoolean("shouldReturnLocalPath", |
| 111 !file_types || !file_types->support_drive); | 111 !file_types || !file_types->support_drive); |
| 112 | 112 |
| 113 std::string json_args; | 113 std::string json_args; |
| 114 base::JSONWriter::Write(&arg_value, &json_args); | 114 base::JSONWriter::Write(&arg_value, &json_args); |
| 115 | 115 |
| 116 // kChromeUIFileManagerURL could not be used since query parameters are not | |
| 117 // supported for it. | |
| 118 std::string url = GetFileManagerMainPageUrl().spec() + '?' + | 116 std::string url = GetFileManagerMainPageUrl().spec() + '?' + |
| 119 net::EscapeUrlEncodedData(json_args, | 117 net::EscapeUrlEncodedData(json_args, |
| 120 false); // Space to %20 instead of +. | 118 false); // Space to %20 instead of +. |
| 121 return GURL(url); | 119 return GURL(url); |
| 122 } | 120 } |
| 123 | 121 |
| 124 GURL GetActionChoiceUrl(const base::FilePath& virtual_path, | 122 GURL GetActionChoiceUrl(const base::FilePath& virtual_path, |
| 125 bool advanced_mode) { | 123 bool advanced_mode) { |
| 126 std::string url = GetFileManagerUrl("/action_choice.html").spec(); | 124 std::string url = GetFileManagerUrl("/action_choice.html").spec(); |
| 127 if (advanced_mode) | 125 if (advanced_mode) |
| 128 url += "?advanced-mode"; | 126 url += "?advanced-mode"; |
| 129 url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), | 127 url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), |
| 130 false); // Space to %20 instead of +. | 128 false); // Space to %20 instead of +. |
| 131 return GURL(url); | 129 return GURL(url); |
| 132 } | 130 } |
| 133 | 131 |
| 134 } // namespace util | 132 } // namespace util |
| 135 } // namespace file_manager | 133 } // namespace file_manager |
| OLD | NEW |