| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/local_discovery/local_discovery_ui_handler.h" | 5 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 cloud_print_printer_list_.reset( | 191 cloud_print_printer_list_.reset( |
| 192 new CloudPrintPrinterList(profile->GetRequestContext(), | 192 new CloudPrintPrinterList(profile->GetRequestContext(), |
| 193 token_service, | 193 token_service, |
| 194 signin_manager->GetAuthenticatedAccountId(), | 194 signin_manager->GetAuthenticatedAccountId(), |
| 195 this)); | 195 this)); |
| 196 cloud_print_printer_list_->Start(); | 196 cloud_print_printer_list_->Start(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void LocalDiscoveryUIHandler::HandleOpenCloudPrintURL( | 199 void LocalDiscoveryUIHandler::HandleOpenCloudPrintURL( |
| 200 const base::ListValue* args) { | 200 const base::ListValue* args) { |
| 201 std::string url; | 201 std::string id; |
| 202 bool rv = args->GetString(0, &url); | 202 bool rv = args->GetString(0, &id); |
| 203 DCHECK(rv); | 203 DCHECK(rv); |
| 204 | 204 |
| 205 GURL url_full(cloud_devices::GetCloudPrintRelativeURL(url)); | |
| 206 | |
| 207 Browser* browser = chrome::FindBrowserWithWebContents( | 205 Browser* browser = chrome::FindBrowserWithWebContents( |
| 208 web_ui()->GetWebContents()); | 206 web_ui()->GetWebContents()); |
| 209 DCHECK(browser); | 207 DCHECK(browser); |
| 210 | 208 |
| 211 chrome::AddSelectedTabWithURL(browser, | 209 chrome::AddSelectedTabWithURL(browser, |
| 212 url_full, | 210 cloud_devices::GetCloudPrintManageDeviceURL(id), |
| 213 content::PAGE_TRANSITION_FROM_API); | 211 content::PAGE_TRANSITION_FROM_API); |
| 214 } | 212 } |
| 215 | 213 |
| 216 void LocalDiscoveryUIHandler::HandleShowSyncUI( | 214 void LocalDiscoveryUIHandler::HandleShowSyncUI( |
| 217 const base::ListValue* args) { | 215 const base::ListValue* args) { |
| 218 Browser* browser = chrome::FindBrowserWithWebContents( | 216 Browser* browser = chrome::FindBrowserWithWebContents( |
| 219 web_ui()->GetWebContents()); | 217 web_ui()->GetWebContents()); |
| 220 DCHECK(browser); | 218 DCHECK(browser); |
| 221 | 219 |
| 222 GURL url(signin::GetPromoURL(signin::SOURCE_DEVICES_PAGE, | 220 GURL url(signin::GetPromoURL(signin::SOURCE_DEVICES_PAGE, |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 } | 592 } |
| 595 | 593 |
| 596 void LocalDiscoveryUIHandler::RefreshCloudPrintStatusFromService() { | 594 void LocalDiscoveryUIHandler::RefreshCloudPrintStatusFromService() { |
| 597 if (cloud_print_connector_ui_enabled_) | 595 if (cloud_print_connector_ui_enabled_) |
| 598 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))-> | 596 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))-> |
| 599 RefreshStatusFromService(); | 597 RefreshStatusFromService(); |
| 600 } | 598 } |
| 601 #endif // cloud print connector option stuff | 599 #endif // cloud print connector option stuff |
| 602 | 600 |
| 603 } // namespace local_discovery | 601 } // namespace local_discovery |
| OLD | NEW |