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

Side by Side Diff: chrome/browser/signin/token_service.cc

Issue 9949024: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-base Created 8 years, 8 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 #include "chrome/browser/signin/token_service.h" 5 #include "chrome/browser/signin/token_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/webdata/web_data_service_factory.h"
11 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 14 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
14 #include "chrome/common/net/gaia/gaia_constants.h" 15 #include "chrome/common/net/gaia/gaia_constants.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
18 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
19 20
20 using content::BrowserThread; 21 using content::BrowserThread;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
56 if (!source_.empty()) { 57 if (!source_.empty()) {
57 // Already initialized. 58 // Already initialized.
58 return; 59 return;
59 } 60 }
60 DCHECK(!profile_); 61 DCHECK(!profile_);
61 profile_ = profile; 62 profile_ = profile;
62 getter_ = profile->GetRequestContext(); 63 getter_ = profile->GetRequestContext();
63 // Since the user can create a bookmark in incognito, sync may be running. 64 // Since the user can create a bookmark in incognito, sync may be running.
64 // Thus we have to go for explicit access. 65 // Thus we have to go for explicit access.
65 web_data_service_ = profile->GetWebDataService(Profile::EXPLICIT_ACCESS); 66 web_data_service_ = WebDataServiceFactory::GetForProfile(
67 profile, Profile::EXPLICIT_ACCESS);
66 source_ = std::string(source); 68 source_ = std::string(source);
67 69
68 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 70 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
69 // Allow the token service to be cleared from the command line. 71 // Allow the token service to be cleared from the command line.
70 if (cmd_line->HasSwitch(switches::kClearTokenService)) 72 if (cmd_line->HasSwitch(switches::kClearTokenService))
71 EraseTokensFromDB(); 73 EraseTokensFromDB();
72 74
73 // Allow a token to be injected from the command line. 75 // Allow a token to be injected from the command line.
74 if (cmd_line->HasSwitch(switches::kSetToken)) { 76 if (cmd_line->HasSwitch(switches::kSetToken)) {
75 std::string value = cmd_line->GetSwitchValueASCII(switches::kSetToken); 77 std::string value = cmd_line->GetSwitchValueASCII(switches::kSetToken);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 363 }
362 364
363 void TokenService::Observe(int type, 365 void TokenService::Observe(int type,
364 const content::NotificationSource& source, 366 const content::NotificationSource& source,
365 const content::NotificationDetails& details) { 367 const content::NotificationDetails& details) {
366 DCHECK_EQ(type, chrome::NOTIFICATION_TOKEN_UPDATED); 368 DCHECK_EQ(type, chrome::NOTIFICATION_TOKEN_UPDATED);
367 TokenAvailableDetails* tok_details = 369 TokenAvailableDetails* tok_details =
368 content::Details<TokenAvailableDetails>(details).ptr(); 370 content::Details<TokenAvailableDetails>(details).ptr();
369 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); 371 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token());
370 } 372 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service_unittest.cc ('k') | chrome/browser/signin/token_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698