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

Side by Side Diff: chrome/browser/ui/webui/local_state/local_state_ui.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/webui/local_state/local_state_ui.h" 5 #include "chrome/browser/ui/webui/local_state/local_state_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 void LocalStateUIHandler::RegisterMessages() { 47 void LocalStateUIHandler::RegisterMessages() {
48 web_ui()->RegisterMessageCallback( 48 web_ui()->RegisterMessageCallback(
49 "requestJson", base::Bind(&LocalStateUIHandler::HandleRequestJson, 49 "requestJson", base::Bind(&LocalStateUIHandler::HandleRequestJson,
50 base::Unretained(this))); 50 base::Unretained(this)));
51 } 51 }
52 52
53 void LocalStateUIHandler::HandleRequestJson(const base::ListValue* args) { 53 void LocalStateUIHandler::HandleRequestJson(const base::ListValue* args) {
54 #if !defined(OS_CHROMEOS) 54 #if !defined(OS_CHROMEOS)
55 scoped_ptr<base::DictionaryValue> local_state_values( 55 std::unique_ptr<base::DictionaryValue> local_state_values(
56 g_browser_process->local_state()->GetPreferenceValuesOmitDefaults()); 56 g_browser_process->local_state()->GetPreferenceValuesOmitDefaults());
57 57
58 std::string json; 58 std::string json;
59 JSONStringValueSerializer serializer(&json); 59 JSONStringValueSerializer serializer(&json);
60 serializer.set_pretty_print(true); 60 serializer.set_pretty_print(true);
61 bool result = serializer.Serialize(*local_state_values); 61 bool result = serializer.Serialize(*local_state_values);
62 if (!result) 62 if (!result)
63 json = "Error loading Local State file."; 63 json = "Error loading Local State file.";
64 64
65 web_ui()->CallJavascriptFunction("localState.setLocalState", 65 web_ui()->CallJavascriptFunction("localState.setLocalState",
(...skipping 10 matching lines...) Expand all
76 html_source->SetDefaultResource(IDR_LOCAL_STATE_HTML); 76 html_source->SetDefaultResource(IDR_LOCAL_STATE_HTML);
77 html_source->AddResourcePath("local_state.js", IDR_LOCAL_STATE_JS); 77 html_source->AddResourcePath("local_state.js", IDR_LOCAL_STATE_JS);
78 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 78 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
79 79
80 // AddMessageHandler takes ownership of LocalStateUIHandler. 80 // AddMessageHandler takes ownership of LocalStateUIHandler.
81 web_ui->AddMessageHandler(new LocalStateUIHandler); 81 web_ui->AddMessageHandler(new LocalStateUIHandler);
82 } 82 }
83 83
84 LocalStateUI::~LocalStateUI() { 84 LocalStateUI::~LocalStateUI() {
85 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698