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

Side by Side Diff: chrome/browser/ui/webui/copresence_ui_handler.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/copresence_ui_handler.h" 5 #include "chrome/browser/ui/webui/copresence_ui_handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 case ReceivedToken::UNKNOWN: 81 case ReceivedToken::UNKNOWN:
82 return std::string(); 82 return std::string();
83 83
84 default: 84 default:
85 NOTREACHED(); 85 NOTREACHED();
86 return std::string(); 86 return std::string();
87 } 87 }
88 } 88 }
89 89
90 template<class T> 90 template <class T>
91 scoped_ptr<DictionaryValue> FormatToken(const T& token) { 91 std::unique_ptr<DictionaryValue> FormatToken(const T& token) {
92 scoped_ptr<DictionaryValue> js_token(new DictionaryValue); 92 std::unique_ptr<DictionaryValue> js_token(new DictionaryValue);
93 93
94 js_token->SetString("id", token.id); 94 js_token->SetString("id", token.id);
95 js_token->SetString("statuses", ConvertStatus(token)); 95 js_token->SetString("statuses", ConvertStatus(token));
96 js_token->SetString("medium", FormatMedium(token.medium)); 96 js_token->SetString("medium", FormatMedium(token.medium));
97 DCHECK(!token.start_time.is_null()); 97 DCHECK(!token.start_time.is_null());
98 js_token->SetString("time", 98 js_token->SetString("time",
99 base::TimeFormatTimeOfDay(token.start_time)); 99 base::TimeFormatTimeOfDay(token.start_time));
100 100
101 return js_token; 101 return js_token;
102 } 102 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::Unretained(this))); 150 base::Unretained(this)));
151 web_ui()->RegisterMessageCallback( 151 web_ui()->RegisterMessageCallback(
152 "clearCopresenceState", 152 "clearCopresenceState",
153 base::Bind(&CopresenceUIHandler::HandleClearState, 153 base::Bind(&CopresenceUIHandler::HandleClearState,
154 base::Unretained(this))); 154 base::Unretained(this)));
155 } 155 }
156 156
157 void CopresenceUIHandler::DirectivesUpdated() { 157 void CopresenceUIHandler::DirectivesUpdated() {
158 ListValue js_directives; 158 ListValue js_directives;
159 for (const Directive& directive : state_->active_directives()) { 159 for (const Directive& directive : state_->active_directives()) {
160 scoped_ptr<DictionaryValue> js_directive(new DictionaryValue); 160 std::unique_ptr<DictionaryValue> js_directive(new DictionaryValue);
161 161
162 js_directive->SetString("type", FormatInstructionType( 162 js_directive->SetString("type", FormatInstructionType(
163 directive.token_instruction().token_instruction_type())); 163 directive.token_instruction().token_instruction_type()));
164 js_directive->SetString("medium", FormatMedium( 164 js_directive->SetString("medium", FormatMedium(
165 directive.token_instruction().medium())); 165 directive.token_instruction().medium()));
166 js_directive->SetString("duration", ui::TimeFormat::Simple( 166 js_directive->SetString("duration", ui::TimeFormat::Simple(
167 ui::TimeFormat::FORMAT_DURATION, 167 ui::TimeFormat::FORMAT_DURATION,
168 ui::TimeFormat::LENGTH_LONG, 168 ui::TimeFormat::LENGTH_LONG,
169 base::TimeDelta::FromMilliseconds(directive.ttl_millis()))); 169 base::TimeDelta::FromMilliseconds(directive.ttl_millis())));
170 170
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 // CopresenceService::ResetState() deletes the CopresenceState object 204 // CopresenceService::ResetState() deletes the CopresenceState object
205 // we were using. We have to get the new one and reconnect to it. 205 // we were using. We have to get the new one and reconnect to it.
206 state_ = GetCopresenceState(service); 206 state_ = GetCopresenceState(service);
207 DCHECK(state_); 207 DCHECK(state_);
208 state_->AddObserver(this); 208 state_->AddObserver(this);
209 209
210 web_ui()->CallJavascriptFunction("clearTokens"); 210 web_ui()->CallJavascriptFunction("clearTokens");
211 DirectivesUpdated(); 211 DirectivesUpdated();
212 } 212 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/copresence_ui.cc ('k') | chrome/browser/ui/webui/domain_reliability_internals_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698