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

Side by Side Diff: chrome/browser/extensions/api/instance_id/instance_id_api.cc

Issue 2111973002: Add support for GCM subtypes to desktop Instance ID implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid9push
Patch Set: Address review comments Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/instance_id/instance_id_api.h" 5 #include "chrome/browser/extensions/api/instance_id/instance_id_api.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 bool InstanceIDApiFunction::IsEnabled() const { 75 bool InstanceIDApiFunction::IsEnabled() const {
76 Profile* profile = Profile::FromBrowserContext(browser_context()); 76 Profile* profile = Profile::FromBrowserContext(browser_context());
77 77
78 return instance_id::InstanceIDProfileService::IsInstanceIDEnabled(profile); 78 return instance_id::InstanceIDProfileService::IsInstanceIDEnabled(profile);
79 } 79 }
80 80
81 instance_id::InstanceID* InstanceIDApiFunction::GetInstanceID() const { 81 instance_id::InstanceID* InstanceIDApiFunction::GetInstanceID() const {
82 return instance_id::InstanceIDProfileServiceFactory::GetForProfile( 82 return instance_id::InstanceIDProfileServiceFactory::GetForProfile(
83 Profile::FromBrowserContext(browser_context()))->driver()-> 83 Profile::FromBrowserContext(browser_context()))
84 GetInstanceID(extension()->id()); 84 ->driver()
85 ->GetInstanceIDForExtensions(extension()->id());
85 } 86 }
86 87
87 InstanceIDGetIDFunction::InstanceIDGetIDFunction() {} 88 InstanceIDGetIDFunction::InstanceIDGetIDFunction() {}
88 89
89 InstanceIDGetIDFunction::~InstanceIDGetIDFunction() {} 90 InstanceIDGetIDFunction::~InstanceIDGetIDFunction() {}
90 91
91 ExtensionFunction::ResponseAction InstanceIDGetIDFunction::DoWork() { 92 ExtensionFunction::ResponseAction InstanceIDGetIDFunction::DoWork() {
92 GetInstanceID()->GetID( 93 GetInstanceID()->GetID(
93 base::Bind(&InstanceIDGetIDFunction::GetIDCompleted, this)); 94 base::Bind(&InstanceIDGetIDFunction::GetIDCompleted, this));
94 return RespondLater(); 95 return RespondLater();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 185
185 void InstanceIDDeleteIDFunction::DeleteIDCompleted( 186 void InstanceIDDeleteIDFunction::DeleteIDCompleted(
186 instance_id::InstanceID::Result result) { 187 instance_id::InstanceID::Result result) {
187 if (result == instance_id::InstanceID::SUCCESS) 188 if (result == instance_id::InstanceID::SUCCESS)
188 Respond(NoArguments()); 189 Respond(NoArguments());
189 else 190 else
190 Respond(Error(InstanceIDResultToError(result))); 191 Respond(Error(InstanceIDResultToError(result)));
191 } 192 }
192 193
193 } // namespace extensions 194 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698