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

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service_factory.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: Remove channel from product_category_for_subtypes, and address nits 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 (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/services/gcm/gcm_profile_service_factory.h" 5 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
13 #include "chrome/browser/signin/signin_manager_factory.h" 13 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/common/channel_info.h"
15 #include "components/gcm_driver/gcm_profile_service.h" 14 #include "components/gcm_driver/gcm_profile_service.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" 15 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 #include "components/signin/core/browser/profile_identity_provider.h" 16 #include "components/signin/core/browser/profile_identity_provider.h"
18 #include "components/signin/core/browser/signin_manager.h" 17 #include "components/signin/core/browser/signin_manager.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 19
21 #if !defined(OS_ANDROID) 20 #if !defined(OS_ANDROID)
21 #include "chrome/browser/services/gcm/gcm_product_util.h"
22 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 22 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
23 #include "chrome/common/channel_info.h"
23 #include "components/gcm_driver/gcm_client_factory.h" 24 #include "components/gcm_driver/gcm_client_factory.h"
24 #endif 25 #endif
25 26
26 namespace gcm { 27 namespace gcm {
27 28
28 // static 29 // static
29 GCMProfileService* GCMProfileServiceFactory::GetForProfile( 30 GCMProfileService* GCMProfileServiceFactory::GetForProfile(
30 content::BrowserContext* profile) { 31 content::BrowserContext* profile) {
31 // GCM is not supported in incognito mode. 32 // GCM is not supported in incognito mode.
32 if (profile->IsOffTheRecord()) 33 if (profile->IsOffTheRecord())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 66 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
66 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 67 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
67 worker_pool->GetSequenceToken(), 68 worker_pool->GetSequenceToken(),
68 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 69 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
69 #if defined(OS_ANDROID) 70 #if defined(OS_ANDROID)
70 return new GCMProfileService(profile->GetPath(), blocking_task_runner); 71 return new GCMProfileService(profile->GetPath(), blocking_task_runner);
71 #else 72 #else
72 return new GCMProfileService( 73 return new GCMProfileService(
73 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), 74 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(),
74 chrome::GetChannel(), 75 chrome::GetChannel(),
76 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()),
75 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( 77 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider(
76 SigninManagerFactory::GetForProfile(profile), 78 SigninManagerFactory::GetForProfile(profile),
77 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 79 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
78 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), 80 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))),
79 std::unique_ptr<GCMClientFactory>(new GCMClientFactory), 81 std::unique_ptr<GCMClientFactory>(new GCMClientFactory),
80 content::BrowserThread::GetTaskRunnerForThread( 82 content::BrowserThread::GetTaskRunnerForThread(
81 content::BrowserThread::UI), 83 content::BrowserThread::UI),
82 content::BrowserThread::GetTaskRunnerForThread( 84 content::BrowserThread::GetTaskRunnerForThread(
83 content::BrowserThread::IO), 85 content::BrowserThread::IO),
84 blocking_task_runner); 86 blocking_task_runner);
85 #endif 87 #endif
86 } 88 }
87 89
88 content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse( 90 content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse(
89 content::BrowserContext* context) const { 91 content::BrowserContext* context) const {
90 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 92 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
91 } 93 }
92 94
93 } // namespace gcm 95 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_product_util.cc ('k') | chrome/browser/services/gcm/gcm_profile_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698