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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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 (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/ui/webui/ntp/new_tab_page_sync_handler.h" 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 BuildAndSendSyncStatus(); 155 BuildAndSendSyncStatus();
156 } 156 }
157 157
158 void NewTabPageSyncHandler::OnSigninAllowedPrefChange() { 158 void NewTabPageSyncHandler::OnSigninAllowedPrefChange() {
159 // Don't do anything if the page has not yet loaded. 159 // Don't do anything if the page has not yet loaded.
160 if (waiting_for_initial_page_load_) 160 if (waiting_for_initial_page_load_)
161 return; 161 return;
162 BuildAndSendSyncStatus(); 162 BuildAndSendSyncStatus();
163 } 163 }
164 164
165 void NewTabPageSyncHandler::SendSyncMessageToPage( 165 void NewTabPageSyncHandler::SendSyncMessageToPage(MessageType type,
166 MessageType type, std::string msg, 166 const std::string& msg,
167 std::string linktext) { 167 const std::string& linktext) {
168 base::DictionaryValue value; 168 base::DictionaryValue value;
169 std::string user; 169 std::string user;
170 std::string title; 170 std::string title;
171 std::string linkurl; 171 std::string linkurl;
172 172
173 // If there is nothing to show, we should hide the sync section altogether. 173 // If there is nothing to show, we should hide the sync section altogether.
174 if (type == HIDE || (msg.empty() && linktext.empty())) { 174 if (type == HIDE || (msg.empty() && linktext.empty())) {
175 value.SetBoolean("syncsectionisvisible", false); 175 value.SetBoolean("syncsectionisvisible", false);
176 } else { 176 } else {
177 if (type == SYNC_ERROR) 177 if (type == SYNC_ERROR)
(...skipping 19 matching lines...) Expand all
197 if (linkurl.empty()) { 197 if (linkurl.empty()) {
198 value.SetBoolean("linkurlisset", false); 198 value.SetBoolean("linkurlisset", false);
199 } else { 199 } else {
200 value.SetBoolean("linkurlisset", true); 200 value.SetBoolean("linkurlisset", true);
201 value.SetString("linkurl", linkurl); 201 value.SetString("linkurl", linkurl);
202 } 202 }
203 } 203 }
204 } 204 }
205 web_ui()->CallJavascriptFunction("ntp.syncMessageChanged", value); 205 web_ui()->CallJavascriptFunction("ntp.syncMessageChanged", value);
206 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698