| OLD | NEW |
| 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/extensions/api/dial/dial_api.h" | 5 #include "chrome/browser/extensions/api/dial/dial_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/extensions/api/dial/dial_api_factory.h" | 10 #include "chrome/browser/extensions/api/dial/dial_api_factory.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 const int kDialExpirationSecs = 240; | 28 const int kDialExpirationSecs = 240; |
| 29 | 29 |
| 30 // The maximum number of devices retained at once in the registry. | 30 // The maximum number of devices retained at once in the registry. |
| 31 const size_t kDialMaxDevices = 256; | 31 const size_t kDialMaxDevices = 256; |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 namespace extensions { | 35 namespace extensions { |
| 36 | 36 |
| 37 DialAPI::DialAPI(Profile* profile) | 37 DialAPI::DialAPI(Profile* profile) |
| 38 : RefcountedProfileKeyedService(content::BrowserThread::IO), | 38 : RefcountedBrowserContextKeyedService(content::BrowserThread::IO), |
| 39 profile_(profile) { | 39 profile_(profile) { |
| 40 ExtensionSystem::Get(profile)->event_router()->RegisterObserver( | 40 ExtensionSystem::Get(profile)->event_router()->RegisterObserver( |
| 41 this, extensions::event_names::kOnDialDeviceList); | 41 this, extensions::event_names::kOnDialDeviceList); |
| 42 } | 42 } |
| 43 | 43 |
| 44 DialAPI::~DialAPI() {} | 44 DialAPI::~DialAPI() {} |
| 45 | 45 |
| 46 DialRegistry* DialAPI::dial_registry() { | 46 DialRegistry* DialAPI::dial_registry() { |
| 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 48 if (!dial_registry_.get()) { | 48 if (!dial_registry_.get()) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if (!result_) | 166 if (!result_) |
| 167 error_ = kDialServiceError; | 167 error_ = kDialServiceError; |
| 168 | 168 |
| 169 SetResult(base::Value::CreateBooleanValue(result_)); | 169 SetResult(base::Value::CreateBooleanValue(result_)); |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace api | 173 } // namespace api |
| 174 | 174 |
| 175 } // namespace extensions | 175 } // namespace extensions |
| OLD | NEW |