OLD | NEW |
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 "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 8 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
9 #include "chrome/browser/signin/token_service.h" | 9 #include "chrome/browser/signin/token_service.h" |
10 #include "chrome/browser/signin/token_service_factory.h" | 10 #include "chrome/browser/signin/token_service_factory.h" |
| 11 #include "chrome/browser/tab_contents/tab_util.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_contents_delegate.h" |
14 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "ui/views/controls/webview/webview.h" |
| 19 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/widget/widget_delegate.h" |
| 21 |
| 22 using content::WebContents; |
| 23 using content::WebContentsDelegate; |
15 | 24 |
16 namespace extensions { | 25 namespace extensions { |
17 | 26 |
18 namespace { | 27 namespace { |
19 | 28 |
20 const char kInvalidClientId[] = "Invalid OAuth2 Client ID."; | 29 const char kInvalidClientId[] = "Invalid OAuth2 Client ID."; |
21 const char kInvalidScopes[] = "Invalid OAuth2 scopes."; | 30 const char kInvalidScopes[] = "Invalid OAuth2 scopes."; |
22 | 31 |
23 } // namespace | 32 } // namespace |
24 | 33 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 Release(); // Balanced in RunImpl. | 72 Release(); // Balanced in RunImpl. |
64 } | 73 } |
65 | 74 |
66 void GetAuthTokenFunction::OnMintTokenFailure( | 75 void GetAuthTokenFunction::OnMintTokenFailure( |
67 const GoogleServiceAuthError& error) { | 76 const GoogleServiceAuthError& error) { |
68 error_ = error.ToString(); | 77 error_ = error.ToString(); |
69 SendResponse(false); | 78 SendResponse(false); |
70 Release(); // Balanced in RunImpl. | 79 Release(); // Balanced in RunImpl. |
71 } | 80 } |
72 | 81 |
| 82 LaunchAuthFlowFunction::LaunchAuthFlowFunction() {} |
| 83 LaunchAuthFlowFunction::~LaunchAuthFlowFunction() {} |
| 84 |
| 85 bool LaunchAuthFlowFunction::RunImpl() { |
| 86 GURL auth_url( |
| 87 "https://www.facebook.com/dialog/oauth" |
| 88 "?client_id=223140341116959" |
| 89 "&redirect_uri=http://munjalsample.appspot.com" |
| 90 "&response_type=token&scope=user_photos"); |
| 91 auth_flow_.reset(new ExtensionAuthFlow( |
| 92 this, profile(), GetExtension()->id(), auth_url)); |
| 93 auth_flow_->Start(); |
| 94 AddRef(); |
| 95 return true; |
| 96 } |
| 97 |
| 98 void LaunchAuthFlowFunction::OnAuthFlowCompleted( |
| 99 const std::string& redirect_url) { |
| 100 result_.reset(Value::CreateStringValue(redirect_url)); |
| 101 SendResponse(true); |
| 102 Release(); |
| 103 } |
| 104 |
73 } // namespace extensions | 105 } // namespace extensions |
OLD | NEW |