Index: chrome/browser/chromeos/dbus/printer_service_provider.cc |
diff --git a/chrome/browser/chromeos/dbus/printer_service_provider.cc b/chrome/browser/chromeos/dbus/printer_service_provider.cc |
index 33cf85e3407598300e35121ec1be979912d7afe8..4fec3c631a2de04353298433574b2b215517d8f3 100644 |
--- a/chrome/browser/chromeos/dbus/printer_service_provider.cc |
+++ b/chrome/browser/chromeos/dbus/printer_service_provider.cc |
@@ -8,9 +8,6 @@ |
#include <limits> |
-#include "ash/session/session_state_delegate.h" |
-#include "ash/shell.h" |
-#include "ash/wm/window_util.h" |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
#include "base/command_line.h" |
@@ -20,28 +17,17 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
-#include "base/sys_info.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/profiles/profile_helper.h" |
#include "chrome/browser/notifications/notification.h" |
#include "chrome/browser/notifications/notification_delegate.h" |
#include "chrome/browser/notifications/notification_ui_manager.h" |
-#include "chrome/browser/profiles/profile_manager.h" |
-#include "chrome/browser/ui/browser.h" |
-#include "chrome/browser/ui/browser_tabstrip.h" |
-#include "chrome/browser/ui/browser_window.h" |
-#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
-#include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
-#include "chrome/browser/ui/tabs/tab_strip_model.h" |
-#include "chrome/common/chrome_version_info.h" |
#include "chrome/common/extensions/api/webstore_widget_private.h" |
#include "chrome/common/extensions/extension_constants.h" |
#include "chrome/grit/generated_resources.h" |
#include "chromeos/chromeos_switches.h" |
#include "components/user_manager/user.h" |
#include "components/user_manager/user_manager.h" |
-#include "content/public/browser/browser_thread.h" |
-#include "content/public/browser/web_contents.h" |
#include "dbus/bus.h" |
#include "dbus/exported_object.h" |
#include "dbus/message.h" |
@@ -54,9 +40,7 @@ |
#include "extensions/common/permissions/permissions_data.h" |
#include "extensions/common/permissions/usb_device_permission.h" |
#include "grit/theme_resources.h" |
-#include "net/base/escape.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
-#include "ui/aura/window.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -79,25 +63,6 @@ enum PrinterServiceEvent { |
PRINTER_SERVICE_EVENT_MAX, |
}; |
-// TODO(vitalybuka): update URL with more relevant information. |
-const char kCloudPrintLearnUrl[] = |
- "https://www.google.com/landing/cloudprint/index.html"; |
- |
-void ActivateContents(Browser* browser, content::WebContents* contents) { |
- browser->tab_strip_model()->ActivateTabAt( |
- browser->tab_strip_model()->GetIndexOfWebContents(contents), false); |
-} |
- |
-Browser* ActivateAndGetBrowserForUrl(GURL url) { |
- for (TabContentsIterator it; !it.done(); it.Next()) { |
- if (it->GetLastCommittedURL() == url) { |
- ActivateContents(it.browser(), *it); |
- return it.browser(); |
- } |
- } |
- return nullptr; |
-} |
- |
bool HexStringToUInt16(const std::string& input, uint16* output) { |
uint32 output_uint = 0; |
if (!base::HexStringToUInt(input, &output_uint) || |
@@ -107,32 +72,6 @@ bool HexStringToUInt16(const std::string& input, uint16* output) { |
return true; |
} |
-void FindOrOpenCloudPrintPage(const std::string& /* vendor */, |
- const std::string& /* product */) { |
- UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", PRINTER_ADDED, |
- PRINTER_SERVICE_EVENT_MAX); |
- if (!ash::Shell::GetInstance()->session_state_delegate()-> |
- IsActiveUserSessionStarted() || |
- ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { |
- return; |
- } |
- |
- Profile* profile = ProfileManager::GetLastUsedProfile(); |
- if (!profile) |
- return; |
- |
- GURL url(kCloudPrintLearnUrl); |
- |
- if (!ActivateAndGetBrowserForUrl(url)) { |
- chrome::ScopedTabbedBrowserDisplayer displayer( |
- profile, chrome::HOST_DESKTOP_TYPE_ASH); |
- UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", |
Vitaly Buka (NO REVIEWS)
2015/05/15 22:00:18
would you like to move PAGE_DISPLAYED, even into S
tbarzic
2015/05/15 22:36:55
deprecated PAGE_DISPLAYED and added new enum value
|
- PAGE_DISPLAYED, PRINTER_SERVICE_EVENT_MAX); |
- chrome::AddSelectedTabWithURL(displayer.browser(), url, |
- ui::PAGE_TRANSITION_LINK); |
- } |
-} |
- |
base::string16 GetNotificationTitle(uint16 vendor_id, uint16 product_id) { |
const char* vendor_name = device::UsbIds::GetVendorName(vendor_id); |
if (vendor_name) { |
@@ -358,13 +297,6 @@ void PrinterServiceProvider::OnExported( |
DVLOG(1) << "Method exported: " << interface_name << "." << method_name; |
} |
-void PrinterServiceProvider::ShowCloudPrintHelp(const std::string& vendor, |
- const std::string& product) { |
- content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
- base::Bind(&FindOrOpenCloudPrintPage, vendor, |
- product)); |
-} |
- |
void PrinterServiceProvider::PrinterAdded( |
dbus::MethodCall* method_call, |
dbus::ExportedObject::ResponseSender response_sender) { |
@@ -382,25 +314,18 @@ void PrinterServiceProvider::PrinterAdded( |
// Send an empty response. |
response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", PRINTER_ADDED, |
+ PRINTER_SERVICE_EVENT_MAX); |
+ |
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnablePrinterAppSearch)) { |
- ShowPrinterPluggedNotification( |
- notification_ui_manager_ ? notification_ui_manager_ |
- : g_browser_process->notification_ui_manager(), |
- vendor_id, product_id); |
return; |
} |
- // Disable showing Cloudprint help on canary and dev channel, as these have |
- // support for printerProvider API. |
- // TODO(tbarzic): Remove this and offer the user to search for an extension |
- // that can act as a print driver (using printerProvider API) for USB printers |
- // detected by this service. http://crbug.com/439448 |
- if (base::SysInfo::IsRunningOnChromeOS() && |
- chrome::VersionInfo::GetChannel() <= chrome::VersionInfo::CHANNEL_DEV) |
- return; |
- |
- ShowCloudPrintHelp(vendor_id, product_id); |
+ ShowPrinterPluggedNotification( |
+ notification_ui_manager_ ? notification_ui_manager_ |
+ : g_browser_process->notification_ui_manager(), |
+ vendor_id, product_id); |
} |
} // namespace chromeos |