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

Unified Diff: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc

Issue 137343005: Send multiple queries when DiscoverNewServices is called on a service watcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
index 72a0087d5d271959d231337784922b9b6269031c..37e6ddc4398369a1ac5a3ed3d43ca5806db34b3d 100644
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
@@ -56,11 +56,7 @@ namespace local_discovery {
namespace {
const char kPrivetAutomatedClaimURLFormat[] = "%s/confirm?token=%s";
-const int kInitialRequeryTimeSeconds = 1;
-const int kMaxRequeryTimeSeconds = 2; // Time for last requery
-
int g_num_visible = 0;
-
} // namespace
LocalDiscoveryUIHandler::LocalDiscoveryUIHandler() : is_visible_(false) {
@@ -143,7 +139,7 @@ void LocalDiscoveryUIHandler::HandleStart(const base::ListValue* args) {
}
privet_lister_->Start();
- SendQuery(kInitialRequeryTimeSeconds);
+ privet_lister_->DiscoverNewDevices(false);
#if defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE)
StartCloudPrintConnector();
@@ -383,7 +379,7 @@ void LocalDiscoveryUIHandler::DeviceRemoved(const std::string& name) {
void LocalDiscoveryUIHandler::DeviceCacheFlushed() {
web_ui()->CallJavascriptFunction("local_discovery.onDeviceCacheFlushed");
- SendQuery(kInitialRequeryTimeSeconds);
+ privet_lister_->DiscoverNewDevices(false);
}
void LocalDiscoveryUIHandler::OnCloudPrintPrinterListReady() {
@@ -506,24 +502,6 @@ void LocalDiscoveryUIHandler::CheckUserLoggedIn() {
logged_in_value);
}
-void LocalDiscoveryUIHandler::ScheduleQuery(int timeout_seconds) {
- if (timeout_seconds <= kMaxRequeryTimeSeconds) {
- requery_callback_.Reset(base::Bind(&LocalDiscoveryUIHandler::SendQuery,
- base::Unretained(this),
- timeout_seconds * 2));
-
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- requery_callback_.callback(),
- base::TimeDelta::FromSeconds(timeout_seconds));
- }
-}
-
-void LocalDiscoveryUIHandler::SendQuery(int next_timeout_seconds) {
- privet_lister_->DiscoverNewDevices(false);
- ScheduleQuery(next_timeout_seconds);
-}
-
#if defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE)
void LocalDiscoveryUIHandler::StartCloudPrintConnector() {
Profile* profile = Profile::FromWebUI(web_ui());

Powered by Google App Engine
This is Rietveld 408576698