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

Side by Side Diff: content/browser/geolocation/mock_location_provider.cc

Issue 12210030: Linux/ChromeOS Chromium style checker cleanup, content/ edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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 4
5 // This file implements a mock location provider and the factory functions for 5 // This file implements a mock location provider and the factory functions for
6 // various ways of creating it. 6 // various ways of creating it.
7 7
8 #include "content/browser/geolocation/mock_location_provider.h" 8 #include "content/browser/geolocation/mock_location_provider.h"
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 position_.accuracy = 3; 79 position_.accuracy = 3;
80 position_.latitude = 4.3; 80 position_.latitude = 4.3;
81 position_.longitude = -7.8; 81 position_.longitude = -7.8;
82 // Webkit compares the timestamp to wall clock time, so we need it to be 82 // Webkit compares the timestamp to wall clock time, so we need it to be
83 // contemporary. 83 // contemporary.
84 position_.timestamp = base::Time::Now(); 84 position_.timestamp = base::Time::Now();
85 } else { 85 } else {
86 position_.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; 86 position_.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
87 } 87 }
88 } 88 }
89 virtual bool StartProvider(bool high_accuracy) { 89 virtual bool StartProvider(bool high_accuracy) OVERRIDE {
90 MockLocationProvider::StartProvider(high_accuracy); 90 MockLocationProvider::StartProvider(high_accuracy);
91 if (!requires_permission_to_start_) { 91 if (!requires_permission_to_start_) {
92 UpdateListenersIfNeeded(); 92 UpdateListenersIfNeeded();
93 } 93 }
94 return true; 94 return true;
95 } 95 }
96 96
97 void OnPermissionGranted() { 97 virtual void OnPermissionGranted() OVERRIDE {
98 MockLocationProvider::OnPermissionGranted(); 98 MockLocationProvider::OnPermissionGranted();
99 if (requires_permission_to_start_) { 99 if (requires_permission_to_start_) {
100 UpdateListenersIfNeeded(); 100 UpdateListenersIfNeeded();
101 } 101 }
102 } 102 }
103 103
104 void UpdateListenersIfNeeded() { 104 void UpdateListenersIfNeeded() {
105 if (!listeners_updated_) { 105 if (!listeners_updated_) {
106 listeners_updated_ = true; 106 listeners_updated_ = true;
107 MessageLoop::current()->PostTask( 107 MessageLoop::current()->PostTask(
(...skipping 18 matching lines...) Expand all
126 126
127 LocationProviderBase* NewAutoFailMockLocationProvider() { 127 LocationProviderBase* NewAutoFailMockLocationProvider() {
128 return new AutoMockLocationProvider(false, false); 128 return new AutoMockLocationProvider(false, false);
129 } 129 }
130 130
131 LocationProviderBase* NewAutoSuccessMockNetworkLocationProvider() { 131 LocationProviderBase* NewAutoSuccessMockNetworkLocationProvider() {
132 return new AutoMockLocationProvider(true, true); 132 return new AutoMockLocationProvider(true, true);
133 } 133 }
134 134
135 } // namespace content 135 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698