Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 AUTH_ERROR, | 44 AUTH_ERROR, |
| 45 INTERNAL_ERROR, | 45 INTERNAL_ERROR, |
| 46 USER_CANCELLED, | 46 USER_CANCELLED, |
| 47 | 47 |
| 48 // This is used for histograms, and should always be the last value. | 48 // This is used for histograms, and should always be the last value. |
| 49 SETUP_ERROR_BOUNDARY | 49 SETUP_ERROR_BOUNDARY |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class Delegate { | 52 class Delegate { |
| 53 public: | 53 public: |
| 54 virtual ~Delegate() { } | |
| 55 | |
| 54 // If successful, |channel_id| will be non-empty. On failure, |channel_id| | 56 // 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 | 57 // will be empty and |error| will contain an error to report to the JS |
| 56 // callback. | 58 // callback. |
| 57 virtual void AppNotifyChannelSetupComplete( | 59 virtual void AppNotifyChannelSetupComplete( |
| 58 const std::string& channel_id, | 60 const std::string& channel_id, |
| 59 const std::string& error, | 61 const std::string& error, |
| 60 const AppNotifyChannelSetup* setup) = 0; | 62 const AppNotifyChannelSetup* setup) = 0; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 // For tests, we allow intercepting the request to setup the channel and | 65 // For tests, we allow intercepting the request to setup the channel and |
| 64 // forcing the return of a certain result to the delegate. | 66 // forcing the return of a certain result to the delegate. |
| 65 class InterceptorForTests { | 67 class InterceptorForTests { |
| 66 public: | 68 public: |
| 67 virtual void DoIntercept( | 69 virtual void DoIntercept( |
| 68 const AppNotifyChannelSetup* setup, | 70 const AppNotifyChannelSetup* setup, |
| 69 std::string* result_channel_id, | 71 std::string* result_channel_id, |
| 70 AppNotifyChannelSetup::SetupError* result_error) = 0; | 72 AppNotifyChannelSetup::SetupError* result_error) = 0; |
| 73 | |
| 74 protected: | |
| 75 virtual ~InterceptorForTests() { } | |
|
jar (doing other things)
2013/02/01 03:41:07
nit: IMO, better is public, unless you have a STRO
Paweł Hajdan Jr.
2013/02/01 10:12:43
Done, sorry I just forgot to change it to public.
| |
| 71 }; | 76 }; |
| 72 static void SetInterceptorForTests(InterceptorForTests* interceptor); | 77 static void SetInterceptorForTests(InterceptorForTests* interceptor); |
| 73 | 78 |
| 74 // Ownership of |ui| is transferred to this object. | 79 // Ownership of |ui| is transferred to this object. |
| 75 AppNotifyChannelSetup(Profile* profile, | 80 AppNotifyChannelSetup(Profile* profile, |
| 76 const std::string& extension_id, | 81 const std::string& extension_id, |
| 77 const std::string& client_id, | 82 const std::string& client_id, |
| 78 const GURL& requestor_url, | 83 const GURL& requestor_url, |
| 79 int return_route_id, | 84 int return_route_id, |
| 80 int callback_id, | 85 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 | 176 // infinite loop of trying to generate access token, if that fails, try |
| 172 // to login the user and generate access token, etc. | 177 // to login the user and generate access token, etc. |
| 173 bool oauth2_access_token_failure_; | 178 bool oauth2_access_token_failure_; |
| 174 | 179 |
| 175 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); | 180 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); |
| 176 }; | 181 }; |
| 177 | 182 |
| 178 } // namespace extensions | 183 } // namespace extensions |
| 179 | 184 |
| 180 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 185 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
| OLD | NEW |