Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager_util.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 dict->SetBoolean("selected", 244 dict->SetBoolean("selected",
245 (static_cast<size_t>(file_type_index) == i)); 245 (static_cast<size_t>(file_type_index) == i));
246 246
247 types_list->Set(i, dict); 247 types_list->Set(i, dict);
248 } 248 }
249 arg_value.Set("typeList", types_list); 249 arg_value.Set("typeList", types_list);
250 } 250 }
251 251
252 std::string json_args; 252 std::string json_args;
253 base::JSONWriter::Write(&arg_value, false, &json_args); 253 base::JSONWriter::Write(&arg_value, &json_args);
254 254
255 // kChromeUIFileManagerURL could not be used since query parameters are not 255 // kChromeUIFileManagerURL could not be used since query parameters are not
256 // supported for it. 256 // supported for it.
257 std::string url = GetFileBrowserUrl().spec() + 257 std::string url = GetFileBrowserUrl().spec() +
258 '?' + net::EscapeUrlEncodedData(json_args, false); 258 '?' + net::EscapeUrlEncodedData(json_args, false);
259 return GURL(url); 259 return GURL(url);
260 } 260 }
261 261
262 string16 GetTitleFromType(SelectFileDialog::Type dialog_type) { 262 string16 GetTitleFromType(SelectFileDialog::Type dialog_type) {
263 string16 title; 263 string16 title;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 FilePath virtual_path; 301 FilePath virtual_path;
302 if (!ConvertFileToRelativeFileSystemPath(browser->profile(), dir, 302 if (!ConvertFileToRelativeFileSystemPath(browser->profile(), dir,
303 &virtual_path)) { 303 &virtual_path)) {
304 return; 304 return;
305 } 305 }
306 306
307 DictionaryValue arg_value; 307 DictionaryValue arg_value;
308 arg_value.SetBoolean("mountTriggered", true); 308 arg_value.SetBoolean("mountTriggered", true);
309 309
310 std::string json_args; 310 std::string json_args;
311 base::JSONWriter::Write(&arg_value, false, &json_args); 311 base::JSONWriter::Write(&arg_value, &json_args);
312 312
313 std::string url = chrome::kChromeUIFileManagerURL; 313 std::string url = chrome::kChromeUIFileManagerURL;
314 url += "?" + json_args + "#/" + 314 url += "?" + json_args + "#/" +
315 net::EscapeUrlEncodedData(virtual_path.value(), false); 315 net::EscapeUrlEncodedData(virtual_path.value(), false);
316 316
317 content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); 317 content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab"));
318 browser->ShowSingletonTabRespectRef(GURL(url)); 318 browser->ShowSingletonTabRespectRef(GURL(url));
319 } 319 }
320 320
321 void OpenFileBrowser(const FilePath& full_path) { 321 void OpenFileBrowser(const FilePath& full_path) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 return false; 489 return false;
490 490
491 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); 491 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile());
492 if (!plugin_prefs) 492 if (!plugin_prefs)
493 return false; 493 return false;
494 494
495 return plugin_prefs->IsPluginEnabled(plugin); 495 return plugin_prefs->IsPluginEnabled(plugin);
496 } 496 }
497 497
498 } // namespace file_manager_util 498 } // namespace file_manager_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698