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

Side by Side Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/extensions/api/identity/identity_api.h" 5 #include "chrome/browser/extensions/api/identity/identity_api.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/app_mode/app_mode_utils.h" 14 #include "chrome/browser/app_mode/app_mode_utils.h"
15 #include "chrome/browser/extensions/extension_function_dispatcher.h" 15 #include "chrome/browser/extensions/extension_function_dispatcher.h"
16 #include "chrome/browser/extensions/extension_install_prompt.h" 16 #include "chrome/browser/extensions/extension_install_prompt.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/permissions_updater.h" 18 #include "chrome/browser/extensions/permissions_updater.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/signin/signin_manager.h" 20 #include "chrome/browser/signin/signin_manager.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/signin/token_service.h" 22 #include "chrome/browser/signin/token_service.h"
23 #include "chrome/browser/signin/token_service_factory.h" 23 #include "chrome/browser/signin/token_service_factory.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/common/extensions/api/experimental_identity.h" 25 #include "chrome/common/extensions/api/experimental_identity.h"
26 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" 26 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h"
27 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
28 #include "chrome/common/extensions/extension_manifest_constants.h" 28 #include "chrome/common/extensions/extension_manifest_constants.h"
29 #include "chrome/common/extensions/manifest_handler.h"
30 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
31 #include "content/public/common/page_transition_types.h" 30 #include "content/public/common/page_transition_types.h"
32 #include "google_apis/gaia/gaia_constants.h" 31 #include "google_apis/gaia/gaia_constants.h"
33 #include "googleurl/src/gurl.h" 32 #include "googleurl/src/gurl.h"
34 #include "ui/base/window_open_disposition.h" 33 #include "ui/base/window_open_disposition.h"
35 34
36 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
37 #include "chrome/browser/chromeos/login/user_manager.h" 36 #include "chrome/browser/chromeos/login/user_manager.h"
38 #endif 37 #endif
39 38
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 516
518 bool IdentityTokenCacheValue::is_expired() const { 517 bool IdentityTokenCacheValue::is_expired() const {
519 return status_ == CACHE_STATUS_NOTFOUND || 518 return status_ == CACHE_STATUS_NOTFOUND ||
520 expiration_time_ < base::Time::Now(); 519 expiration_time_ < base::Time::Now();
521 } 520 }
522 521
523 IdentityAPI::IdentityAPI(Profile* profile) 522 IdentityAPI::IdentityAPI(Profile* profile)
524 : profile_(profile), 523 : profile_(profile),
525 signin_manager_(NULL), 524 signin_manager_(NULL),
526 error_(GoogleServiceAuthError::NONE) { 525 error_(GoogleServiceAuthError::NONE) {
527 (new OAuth2ManifestHandler)->Register();
528 } 526 }
529 527
530 IdentityAPI::~IdentityAPI() { 528 IdentityAPI::~IdentityAPI() {
531 } 529 }
532 530
533 void IdentityAPI::Initialize() { 531 void IdentityAPI::Initialize() {
534 signin_manager_ = SigninManagerFactory::GetForProfile(profile_); 532 signin_manager_ = SigninManagerFactory::GetForProfile(profile_);
535 signin_manager_->signin_global_error()->AddProvider(this); 533 signin_manager_->signin_global_error()->AddProvider(this);
536 534
537 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); 535 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 const IdentityAPI::TokenCacheKey& rhs) const { 638 const IdentityAPI::TokenCacheKey& rhs) const {
641 if (extension_id < rhs.extension_id) 639 if (extension_id < rhs.extension_id)
642 return true; 640 return true;
643 else if (rhs.extension_id < extension_id) 641 else if (rhs.extension_id < extension_id)
644 return false; 642 return false;
645 643
646 return scopes < rhs.scopes; 644 return scopes < rhs.scopes;
647 } 645 }
648 646
649 } // namespace extensions 647 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698