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

Side by Side Diff: chrome/browser/chrome_to_mobile_service.h

Issue 10918119: Reland: Adjust ChromeToMobile error logging and mitigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Manage URLFetcher lifetimes with a ScopedVector. Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/chrome_to_mobile_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
6 #define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 6 #define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/memory/scoped_vector.h"
Raghu Simha 2012/09/07 17:15:55 nit: This goes above weak_ptr.h.
17 #include "base/string16.h" 18 #include "base/string16.h"
18 #include "base/timer.h" 19 #include "base/timer.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "chrome/browser/profiles/profile_keyed_service.h" 21 #include "chrome/browser/profiles/profile_keyed_service.h"
21 #include "chrome/browser/sessions/session_id.h" 22 #include "chrome/browser/sessions/session_id.h"
22 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
24 #include "google_apis/gaia/oauth2_access_token_consumer.h" 25 #include "google_apis/gaia/oauth2_access_token_consumer.h"
25 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
26 #include "net/url_request/url_fetcher_delegate.h" 27 #include "net/url_request/url_fetcher_delegate.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 DEVICES_REQUESTED = 0, // Cloud print was contacted to list devices. 61 DEVICES_REQUESTED = 0, // Cloud print was contacted to list devices.
61 DEVICES_AVAILABLE, // Cloud print returned 1+ compatible devices. 62 DEVICES_AVAILABLE, // Cloud print returned 1+ compatible devices.
62 BUBBLE_SHOWN, // The page action bubble was shown. 63 BUBBLE_SHOWN, // The page action bubble was shown.
63 SNAPSHOT_GENERATED, // A snapshot was successfully generated. 64 SNAPSHOT_GENERATED, // A snapshot was successfully generated.
64 SNAPSHOT_ERROR, // An error occurred during snapshot generation. 65 SNAPSHOT_ERROR, // An error occurred during snapshot generation.
65 SENDING_URL, // Send was invoked (with or without a snapshot). 66 SENDING_URL, // Send was invoked (with or without a snapshot).
66 SENDING_SNAPSHOT, // A snapshot was sent along with the page URL. 67 SENDING_SNAPSHOT, // A snapshot was sent along with the page URL.
67 SEND_SUCCESS, // Cloud print responded with success on send. 68 SEND_SUCCESS, // Cloud print responded with success on send.
68 SEND_ERROR, // Cloud print responded with failure on send. 69 SEND_ERROR, // Cloud print responded with failure on send.
69 LEARN_MORE_CLICKED, // The "Learn more" help article link was clicked. 70 LEARN_MORE_CLICKED, // The "Learn more" help article link was clicked.
71 BAD_TOKEN, // The cloud print access token could not be minted.
72 BAD_SEARCH_AUTH, // The cloud print search request failed (auth).
73 BAD_SEARCH_OTHER, // The cloud print search request failed (other).
74 BAD_SEND_407, // The cloud print send response was errorCode==407.
75 // "Print job added but failed to notify printer..."
76 BAD_SEND_ERROR, // The cloud print send response was errorCode!=407.
77 BAD_SEND_AUTH, // The cloud print send request failed (auth).
78 BAD_SEND_OTHER, // The cloud print send request failed (other).
70 NUM_METRICS 79 NUM_METRICS
71 }; 80 };
72 81
73 // The supported mobile device operating systems. 82 // The supported mobile device operating systems.
74 enum MobileOS { 83 enum MobileOS {
75 ANDROID = 0, 84 ANDROID = 0,
76 IOS, 85 IOS,
77 }; 86 };
78 87
79 // The cloud print job types. 88 // The cloud print job types.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 std::string access_token_; 225 std::string access_token_;
217 226
218 // The set of snapshots currently available. 227 // The set of snapshots currently available.
219 std::set<FilePath> snapshots_; 228 std::set<FilePath> snapshots_;
220 229
221 // Map URLFetchers to observers for reporting OnSendComplete. 230 // Map URLFetchers to observers for reporting OnSendComplete.
222 typedef std::map<const net::URLFetcher*, base::WeakPtr<Observer> > 231 typedef std::map<const net::URLFetcher*, base::WeakPtr<Observer> >
223 RequestObserverMap; 232 RequestObserverMap;
224 RequestObserverMap request_observer_map_; 233 RequestObserverMap request_observer_map_;
225 234
226 // The pending OAuth access token request and a timer for retrying on failure. 235 // The list of active URLFetcher requests owned by the service.
236 ScopedVector<net::URLFetcher> url_fetchers_;
237
238 // The pending OAuth access token request and timers for retrying on failure.
227 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_; 239 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_;
228 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_; 240 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_;
241 base::OneShotTimer<ChromeToMobileService> search_retry_timer_;
229 242
230 // A queue of tasks to perform after an access token is lazily initialized. 243 // A queue of tasks to perform after an access token is lazily initialized.
231 std::queue<base::Closure> task_queue_; 244 std::queue<base::Closure> task_queue_;
232 245
233 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService); 246 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService);
234 }; 247 };
235 248
236 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 249 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_to_mobile_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698