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

Side by Side Diff: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 9 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
OLDNEW
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/user_metrics.h"
13 #include "base/stl_util.h" 14 #include "base/stl_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" 18 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
18 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 20 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
20 #include "chrome/browser/printing/cloud_print/privet_confirm_api_flow.h" 21 #include "chrome/browser/printing/cloud_print/privet_confirm_api_flow.h"
21 #include "chrome/browser/printing/cloud_print/privet_constants.h" 22 #include "chrome/browser/printing/cloud_print/privet_constants.h"
22 #include "chrome/browser/printing/cloud_print/privet_device_lister_impl.h" 23 #include "chrome/browser/printing/cloud_print/privet_device_lister_impl.h"
23 #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h " 24 #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h "
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
26 #include "chrome/browser/signin/signin_manager_factory.h" 27 #include "chrome/browser/signin/signin_manager_factory.h"
27 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/browser_tabstrip.h" 29 #include "chrome/browser/ui/browser_tabstrip.h"
29 #include "chrome/browser/ui/chrome_pages.h" 30 #include "chrome/browser/ui/chrome_pages.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/grit/generated_resources.h" 32 #include "chrome/grit/generated_resources.h"
32 #include "components/cloud_devices/common/cloud_devices_urls.h" 33 #include "components/cloud_devices/common/cloud_devices_urls.h"
33 #include "components/prefs/pref_service.h" 34 #include "components/prefs/pref_service.h"
34 #include "components/signin/core/browser/profile_oauth2_token_service.h" 35 #include "components/signin/core/browser/profile_oauth2_token_service.h"
35 #include "content/public/browser/user_metrics.h"
36 #include "content/public/browser/web_ui.h" 36 #include "content/public/browser/web_ui.h"
37 #include "printing/features/features.h" 37 #include "printing/features/features.h"
38 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
39 39
40 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OS_CHROMEOS) 40 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OS_CHROMEOS)
41 #define CLOUD_PRINT_CONNECTOR_UI_AVAILABLE 41 #define CLOUD_PRINT_CONNECTOR_UI_AVAILABLE
42 #endif 42 #endif
43 43
44 using cloud_print::CloudPrintPrinterList; 44 using cloud_print::CloudPrintPrinterList;
45 using cloud_print::DeviceDescription; 45 using cloud_print::DeviceDescription;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 SetupCloudPrintConnectorSection(); 550 SetupCloudPrintConnectorSection();
551 RefreshCloudPrintStatusFromService(); 551 RefreshCloudPrintStatusFromService();
552 } 552 }
553 553
554 void LocalDiscoveryUIHandler::OnCloudPrintPrefsChanged() { 554 void LocalDiscoveryUIHandler::OnCloudPrintPrefsChanged() {
555 SetupCloudPrintConnectorSection(); 555 SetupCloudPrintConnectorSection();
556 } 556 }
557 557
558 void LocalDiscoveryUIHandler::ShowCloudPrintSetupDialog( 558 void LocalDiscoveryUIHandler::ShowCloudPrintSetupDialog(
559 const base::ListValue* args) { 559 const base::ListValue* args) {
560 content::RecordAction( 560 base::RecordAction(base::UserMetricsAction("Options_EnableCloudPrintProxy"));
561 base::UserMetricsAction("Options_EnableCloudPrintProxy"));
562 // Open the connector enable page in the current tab. 561 // Open the connector enable page in the current tab.
563 content::OpenURLParams params(cloud_devices::GetCloudPrintEnableURL( 562 content::OpenURLParams params(cloud_devices::GetCloudPrintEnableURL(
564 GetCloudPrintProxyService()->proxy_id()), 563 GetCloudPrintProxyService()->proxy_id()),
565 content::Referrer(), 564 content::Referrer(),
566 WindowOpenDisposition::CURRENT_TAB, 565 WindowOpenDisposition::CURRENT_TAB,
567 ui::PAGE_TRANSITION_LINK, false); 566 ui::PAGE_TRANSITION_LINK, false);
568 web_ui()->GetWebContents()->OpenURL(params); 567 web_ui()->GetWebContents()->OpenURL(params);
569 } 568 }
570 569
571 void LocalDiscoveryUIHandler::HandleDisableCloudPrintConnector( 570 void LocalDiscoveryUIHandler::HandleDisableCloudPrintConnector(
572 const base::ListValue* args) { 571 const base::ListValue* args) {
573 content::RecordAction( 572 base::RecordAction(base::UserMetricsAction("Options_DisableCloudPrintProxy"));
574 base::UserMetricsAction("Options_DisableCloudPrintProxy"));
575 GetCloudPrintProxyService()->DisableForUser(); 573 GetCloudPrintProxyService()->DisableForUser();
576 } 574 }
577 575
578 void LocalDiscoveryUIHandler::SetupCloudPrintConnectorSection() { 576 void LocalDiscoveryUIHandler::SetupCloudPrintConnectorSection() {
579 bool cloud_print_connector_allowed = 577 bool cloud_print_connector_allowed =
580 !cloud_print_connector_enabled_.IsManaged() || 578 !cloud_print_connector_enabled_.IsManaged() ||
581 cloud_print_connector_enabled_.GetValue(); 579 cloud_print_connector_enabled_.GetValue();
582 base::Value allowed(cloud_print_connector_allowed); 580 base::Value allowed(cloud_print_connector_allowed);
583 581
584 std::string email; 582 std::string email;
(...skipping 28 matching lines...) Expand all
613 service->RefreshStatusFromService(); 611 service->RefreshStatusFromService();
614 } 612 }
615 613
616 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() { 614 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() {
617 return CloudPrintProxyServiceFactory::GetForProfile( 615 return CloudPrintProxyServiceFactory::GetForProfile(
618 Profile::FromWebUI(web_ui())); 616 Profile::FromWebUI(web_ui()));
619 } 617 }
620 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) 618 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE)
621 619
622 } // namespace local_discovery 620 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui.cc ('k') | chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698