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

Side by Side Diff: extensions/browser/api/idle/idle_manager.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 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
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 "extensions/browser/api/idle/idle_manager.h" 5 #include "extensions/browser/api/idle/idle_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 DCHECK(thread_checker_.CalledOnValidThread()); 174 DCHECK(thread_checker_.CalledOnValidThread());
175 idle_time_provider_->CalculateIdleState(threshold, notify); 175 idle_time_provider_->CalculateIdleState(threshold, notify);
176 } 176 }
177 177
178 void IdleManager::SetThreshold(const std::string& extension_id, int threshold) { 178 void IdleManager::SetThreshold(const std::string& extension_id, int threshold) {
179 DCHECK(thread_checker_.CalledOnValidThread()); 179 DCHECK(thread_checker_.CalledOnValidThread());
180 GetMonitor(extension_id)->threshold = threshold; 180 GetMonitor(extension_id)->threshold = threshold;
181 } 181 }
182 182
183 // static 183 // static
184 std::unique_ptr<base::StringValue> IdleManager::CreateIdleValue( 184 std::unique_ptr<base::Value> IdleManager::CreateIdleValue(
185 ui::IdleState idle_state) { 185 ui::IdleState idle_state) {
186 const char* description; 186 const char* description;
187 187
188 if (idle_state == ui::IDLE_STATE_ACTIVE) { 188 if (idle_state == ui::IDLE_STATE_ACTIVE) {
189 description = keys::kStateActive; 189 description = keys::kStateActive;
190 } else if (idle_state == ui::IDLE_STATE_IDLE) { 190 } else if (idle_state == ui::IDLE_STATE_IDLE) {
191 description = keys::kStateIdle; 191 description = keys::kStateIdle;
192 } else { 192 } else {
193 description = keys::kStateLocked; 193 description = keys::kStateLocked;
194 } 194 }
195 195
196 return base::MakeUnique<base::StringValue>(description); 196 return base::MakeUnique<base::Value>(description);
197 } 197 }
198 198
199 void IdleManager::SetEventDelegateForTest( 199 void IdleManager::SetEventDelegateForTest(
200 std::unique_ptr<EventDelegate> event_delegate) { 200 std::unique_ptr<EventDelegate> event_delegate) {
201 DCHECK(thread_checker_.CalledOnValidThread()); 201 DCHECK(thread_checker_.CalledOnValidThread());
202 event_delegate_ = std::move(event_delegate); 202 event_delegate_ = std::move(event_delegate);
203 } 203 }
204 204
205 void IdleManager::SetIdleTimeProviderForTest( 205 void IdleManager::SetIdleTimeProviderForTest(
206 std::unique_ptr<IdleTimeProvider> idle_time_provider) { 206 std::unique_ptr<IdleTimeProvider> idle_time_provider) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 event_delegate_->OnStateChanged(it->first, new_state); 256 event_delegate_->OnStateChanged(it->first, new_state);
257 monitor.last_state = new_state; 257 monitor.last_state = new_state;
258 listener_count += monitor.listeners; 258 listener_count += monitor.listeners;
259 } 259 }
260 260
261 if (listener_count == 0) 261 if (listener_count == 0)
262 StopPolling(); 262 StopPolling();
263 } 263 }
264 264
265 } // namespace extensions 265 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/idle/idle_manager.h ('k') | extensions/browser/api/metrics_private/metrics_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698