| 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 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 class Delegate { | 52 class Delegate { |
| 53 public: | 53 public: |
| 54 // If successful, |channel_id| will be non-empty. On failure, |channel_id| | 54 // If successful, |channel_id| will be non-empty. On failure, |channel_id| |
| 55 // will be empty and |error| will contain an error to report to the JS | 55 // will be empty and |error| will contain an error to report to the JS |
| 56 // callback. | 56 // callback. |
| 57 virtual void AppNotifyChannelSetupComplete( | 57 virtual void AppNotifyChannelSetupComplete( |
| 58 const std::string& channel_id, | 58 const std::string& channel_id, |
| 59 const std::string& error, | 59 const std::string& error, |
| 60 const AppNotifyChannelSetup* setup) = 0; | 60 const AppNotifyChannelSetup* setup) = 0; |
| 61 |
| 62 protected: |
| 63 virtual ~Delegate() { } |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 // For tests, we allow intercepting the request to setup the channel and | 66 // For tests, we allow intercepting the request to setup the channel and |
| 64 // forcing the return of a certain result to the delegate. | 67 // forcing the return of a certain result to the delegate. |
| 65 class InterceptorForTests { | 68 class InterceptorForTests { |
| 66 public: | 69 public: |
| 67 virtual void DoIntercept( | 70 virtual void DoIntercept( |
| 68 const AppNotifyChannelSetup* setup, | 71 const AppNotifyChannelSetup* setup, |
| 69 std::string* result_channel_id, | 72 std::string* result_channel_id, |
| 70 AppNotifyChannelSetup::SetupError* result_error) = 0; | 73 AppNotifyChannelSetup::SetupError* result_error) = 0; |
| 74 |
| 75 protected: |
| 76 virtual ~InterceptorForTests() { } |
| 71 }; | 77 }; |
| 72 static void SetInterceptorForTests(InterceptorForTests* interceptor); | 78 static void SetInterceptorForTests(InterceptorForTests* interceptor); |
| 73 | 79 |
| 74 // Ownership of |ui| is transferred to this object. | 80 // Ownership of |ui| is transferred to this object. |
| 75 AppNotifyChannelSetup(Profile* profile, | 81 AppNotifyChannelSetup(Profile* profile, |
| 76 const std::string& extension_id, | 82 const std::string& extension_id, |
| 77 const std::string& client_id, | 83 const std::string& client_id, |
| 78 const GURL& requestor_url, | 84 const GURL& requestor_url, |
| 79 int return_route_id, | 85 int return_route_id, |
| 80 int callback_id, | 86 int callback_id, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // infinite loop of trying to generate access token, if that fails, try | 177 // infinite loop of trying to generate access token, if that fails, try |
| 172 // to login the user and generate access token, etc. | 178 // to login the user and generate access token, etc. |
| 173 bool oauth2_access_token_failure_; | 179 bool oauth2_access_token_failure_; |
| 174 | 180 |
| 175 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); | 181 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); |
| 176 }; | 182 }; |
| 177 | 183 |
| 178 } // namespace extensions | 184 } // namespace extensions |
| 179 | 185 |
| 180 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 186 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
| OLD | NEW |