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

Side by Side Diff: extensions/shell/browser/shell_oauth2_token_service.cc

Issue 1059973004: favor DCHECK_CURRENTLY_ON for better logs in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « extensions/shell/browser/shell_browser_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/shell/browser/shell_oauth2_token_service.h" 5 #include "extensions/shell/browser/shell_oauth2_token_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" 10 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 namespace { 13 namespace {
14 14
15 ShellOAuth2TokenService* g_instance = nullptr; 15 ShellOAuth2TokenService* g_instance = nullptr;
16 16
17 } // namespace 17 } // namespace
18 18
19 ShellOAuth2TokenService::ShellOAuth2TokenService( 19 ShellOAuth2TokenService::ShellOAuth2TokenService(
20 content::BrowserContext* browser_context, 20 content::BrowserContext* browser_context,
21 std::string account_id, 21 std::string account_id,
22 std::string refresh_token) 22 std::string refresh_token)
23 : browser_context_(browser_context), 23 : browser_context_(browser_context),
24 account_id_(account_id), 24 account_id_(account_id),
25 refresh_token_(refresh_token) { 25 refresh_token_(refresh_token) {
26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 26 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
27 DCHECK(!g_instance); 27 DCHECK(!g_instance);
28 g_instance = this; 28 g_instance = this;
29 } 29 }
30 30
31 ShellOAuth2TokenService::~ShellOAuth2TokenService() { 31 ShellOAuth2TokenService::~ShellOAuth2TokenService() {
32 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 32 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
33 DCHECK(g_instance); 33 DCHECK(g_instance);
34 g_instance = nullptr; 34 g_instance = nullptr;
35 } 35 }
36 36
37 // static 37 // static
38 ShellOAuth2TokenService* ShellOAuth2TokenService::GetInstance() { 38 ShellOAuth2TokenService* ShellOAuth2TokenService::GetInstance() {
39 DCHECK(g_instance); 39 DCHECK(g_instance);
40 return g_instance; 40 return g_instance;
41 } 41 }
42 42
(...skipping 18 matching lines...) Expand all
61 OAuth2AccessTokenConsumer* consumer) { 61 OAuth2AccessTokenConsumer* consumer) {
62 DCHECK(!refresh_token_.empty()); 62 DCHECK(!refresh_token_.empty());
63 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_); 63 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_);
64 } 64 }
65 65
66 net::URLRequestContextGetter* ShellOAuth2TokenService::GetRequestContext() { 66 net::URLRequestContextGetter* ShellOAuth2TokenService::GetRequestContext() {
67 return browser_context_->GetRequestContext(); 67 return browser_context_->GetRequestContext();
68 } 68 }
69 69
70 } // namespace extensions 70 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_browser_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698