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

Side by Side Diff: chrome/browser/extensions/api/location/location_api.cc

Issue 330383003: Remove deprecated extension notifications from APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Broadcast and nits Created 6 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/api/location/location_api.h" 5 #include "chrome/browser/extensions/api/location/location_api.h"
6 6
7 #include "chrome/browser/extensions/api/location/location_manager.h" 7 #include "chrome/browser/extensions/api/location/location_manager.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/extensions/api/location.h" 8 #include "chrome/common/extensions/api/location.h"
10 #include "extensions/common/error_utils.h" 9 #include "extensions/common/error_utils.h"
11 10
12 // TODO(vadimt): add tests. 11 // TODO(vadimt): add tests.
13 12
14 namespace location = extensions::api::location; 13 namespace location = extensions::api::location;
15 namespace WatchLocation = location::WatchLocation; 14 namespace WatchLocation = location::WatchLocation;
16 namespace ClearWatch = location::ClearWatch; 15 namespace ClearWatch = location::ClearWatch;
17 16
18 namespace extensions { 17 namespace extensions {
(...skipping 23 matching lines...) Expand all
42 double* min_time_in_milliseconds = 41 double* min_time_in_milliseconds =
43 params->request_info.min_time_in_milliseconds.get(); 42 params->request_info.min_time_in_milliseconds.get();
44 if (IsNegative(min_time_in_milliseconds)) { 43 if (IsNegative(min_time_in_milliseconds)) {
45 error_ = ErrorUtils::FormatErrorMessage( 44 error_ = ErrorUtils::FormatErrorMessage(
46 kMustBePositive, 45 kMustBePositive,
47 kMinTimeInMilliseconds); 46 kMinTimeInMilliseconds);
48 return false; 47 return false;
49 } 48 }
50 49
51 // TODO(vadimt): validate and use params->request_info.maximumAge 50 // TODO(vadimt): validate and use params->request_info.maximumAge
52 LocationManager::Get(GetProfile()) 51 LocationManager::Get(browser_context())
53 ->AddLocationRequest(extension_id(), 52 ->AddLocationRequest(extension_id(),
54 params->name, 53 params->name,
55 min_distance_in_meters, 54 min_distance_in_meters,
56 min_time_in_milliseconds); 55 min_time_in_milliseconds);
57 56
58 return true; 57 return true;
59 } 58 }
60 59
61 bool LocationClearWatchFunction::RunSync() { 60 bool LocationClearWatchFunction::RunSync() {
62 scoped_ptr<ClearWatch::Params> params( 61 scoped_ptr<ClearWatch::Params> params(
63 ClearWatch::Params::Create(*args_)); 62 ClearWatch::Params::Create(*args_));
64 EXTENSION_FUNCTION_VALIDATE(params.get()); 63 EXTENSION_FUNCTION_VALIDATE(params.get());
65 64
66 LocationManager::Get(GetProfile()) 65 LocationManager::Get(browser_context())
67 ->RemoveLocationRequest(extension_id(), params->name); 66 ->RemoveLocationRequest(extension_id(), params->name);
68 67
69 return true; 68 return true;
70 } 69 }
71 70
72 } // namespace extensions 71 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698