| OLD | NEW |
| 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/chromeos/dbus/printer_service_provider.h" | 5 #include "chrome/browser/chromeos/dbus/printer_service_provider.h" |
| 6 | 6 |
| 7 #include "ash/session_state_delegate.h" | |
| 8 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_tabstrip.h" | 17 #include "chrome/browser/ui/browser_tabstrip.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return it.browser(); | 53 return it.browser(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 return NULL; | 56 return NULL; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void FindOrOpenCloudPrintPage(const std::string& /* vendor */, | 59 void FindOrOpenCloudPrintPage(const std::string& /* vendor */, |
| 60 const std::string& /* product */) { | 60 const std::string& /* product */) { |
| 61 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", PRINTER_ADDED, | 61 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", PRINTER_ADDED, |
| 62 PRINTER_SERVICE_EVENT_MAX); | 62 PRINTER_SERVICE_EVENT_MAX); |
| 63 if (!ash::Shell::GetInstance()->session_state_delegate()-> | 63 if (!ash::Shell::GetInstance()->delegate()->IsSessionStarted() || |
| 64 IsActiveUserSessionStarted() || | 64 ash::Shell::GetInstance()->delegate()->IsScreenLocked()) { |
| 65 ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { | |
| 66 return; | 65 return; |
| 67 } | 66 } |
| 68 | 67 |
| 69 Profile* profile = ProfileManager::GetLastUsedProfile(); | 68 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 70 if (!profile) | 69 if (!profile) |
| 71 return; | 70 return; |
| 72 | 71 |
| 73 GURL url(kCloudPrintLearnUrl); | 72 GURL url(kCloudPrintLearnUrl); |
| 74 | 73 |
| 75 Browser* browser = ActivateAndGetBrowserForUrl(url); | 74 Browser* browser = ActivateAndGetBrowserForUrl(url); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 reader.PopString(&vendor); | 145 reader.PopString(&vendor); |
| 147 reader.PopString(&product); | 146 reader.PopString(&product); |
| 148 ShowCloudPrintHelp(vendor, product); | 147 ShowCloudPrintHelp(vendor, product); |
| 149 | 148 |
| 150 // Send an empty response. | 149 // Send an empty response. |
| 151 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 150 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace chromeos | 153 } // namespace chromeos |
| 155 | 154 |
| OLD | NEW |