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

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

Issue 10885024: Integrate Chrome To Mobile with Action Box UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address cocoa comments. 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
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/chrome_to_mobile_service.h" 5 #include "chrome/browser/chrome_to_mobile_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 30 matching lines...) Expand all
41 #include "google/cacheinvalidation/include/types.h" 41 #include "google/cacheinvalidation/include/types.h"
42 #include "google/cacheinvalidation/types.pb.h" 42 #include "google/cacheinvalidation/types.pb.h"
43 #include "net/base/escape.h" 43 #include "net/base/escape.h"
44 #include "net/base/load_flags.h" 44 #include "net/base/load_flags.h"
45 #include "net/url_request/url_fetcher.h" 45 #include "net/url_request/url_fetcher.h"
46 #include "net/url_request/url_request_context_getter.h" 46 #include "net/url_request/url_request_context_getter.h"
47 #include "sync/notifier/invalidation_util.h" 47 #include "sync/notifier/invalidation_util.h"
48 48
49 namespace { 49 namespace {
50 50
51 // The default enabled/disabled state of the Chrome To Mobile feature.
52 const bool kChromeToMobileEnabled = true;
53
54 // The maximum number of retries for the URLFetcher requests. 51 // The maximum number of retries for the URLFetcher requests.
55 const size_t kMaxRetries = 1; 52 const size_t kMaxRetries = 1;
56 53
57 // The number of hours to delay before retrying authentication on failure. 54 // The number of hours to delay before retrying authentication on failure.
58 const size_t kAuthRetryDelayHours = 6; 55 const size_t kAuthRetryDelayHours = 6;
59 56
60 // The number of hours before subsequent search requests are allowed. 57 // The number of hours before subsequent search requests are allowed.
61 // This value is used to throttle expensive cloud print search requests. 58 // This value is used to throttle expensive cloud print search requests.
62 // Note that this limitation does not hold across application restarts. 59 // Note that this limitation does not hold across application restarts.
63 const int kSearchRequestDelayHours = 24; 60 const int kSearchRequestDelayHours = 24;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } // namespace 155 } // namespace
159 156
160 ChromeToMobileService::Observer::~Observer() {} 157 ChromeToMobileService::Observer::~Observer() {}
161 158
162 ChromeToMobileService::JobData::JobData() : mobile_os(ANDROID), type(URL) {} 159 ChromeToMobileService::JobData::JobData() : mobile_os(ANDROID), type(URL) {}
163 160
164 ChromeToMobileService::JobData::~JobData() {} 161 ChromeToMobileService::JobData::~JobData() {}
165 162
166 // static 163 // static
167 bool ChromeToMobileService::IsChromeToMobileEnabled() { 164 bool ChromeToMobileService::IsChromeToMobileEnabled() {
168 CommandLine* command_line = CommandLine::ForCurrentProcess(); 165 // Chrome To Mobile is currently gated on the Action Box UI.
169 166 return CommandLine::ForCurrentProcess()->HasSwitch(
170 if (command_line->HasSwitch(switches::kDisableChromeToMobile)) 167 switches::kEnableActionBox);
171 return false;
172
173 if (command_line->HasSwitch(switches::kEnableChromeToMobile))
174 return true;
175
176 return kChromeToMobileEnabled;
177 } 168 }
178 169
179 // static 170 // static
180 void ChromeToMobileService::RegisterUserPrefs(PrefService* prefs) { 171 void ChromeToMobileService::RegisterUserPrefs(PrefService* prefs) {
181 prefs->RegisterListPref(prefs::kChromeToMobileDeviceList, 172 prefs->RegisterListPref(prefs::kChromeToMobileDeviceList,
182 PrefService::UNSYNCABLE_PREF); 173 PrefService::UNSYNCABLE_PREF);
183 } 174 }
184 175
185 ChromeToMobileService::ChromeToMobileService(Profile* profile) 176 ChromeToMobileService::ChromeToMobileService(Profile* profile)
186 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), 177 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 592
602 // Report failure below and ignore the second response. 593 // Report failure below and ignore the second response.
603 request_observer_map_.erase(other); 594 request_observer_map_.erase(other);
604 break; 595 break;
605 } 596 }
606 } 597 }
607 598
608 if (observer.get()) 599 if (observer.get())
609 observer->OnSendComplete(success); 600 observer->OnSendComplete(success);
610 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698