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" |
7 #include "ash/shell.h" | 8 #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()->delegate()->IsSessionStarted() || | 63 if (!ash::Shell::GetInstance()->session_state_delegate()-> |
64 ash::Shell::GetInstance()->delegate()->IsScreenLocked()) { | 64 IsActiveUserSessionStarted() || |
| 65 ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { |
65 return; | 66 return; |
66 } | 67 } |
67 | 68 |
68 Profile* profile = ProfileManager::GetLastUsedProfile(); | 69 Profile* profile = ProfileManager::GetLastUsedProfile(); |
69 if (!profile) | 70 if (!profile) |
70 return; | 71 return; |
71 | 72 |
72 GURL url(kCloudPrintLearnUrl); | 73 GURL url(kCloudPrintLearnUrl); |
73 | 74 |
74 Browser* browser = ActivateAndGetBrowserForUrl(url); | 75 Browser* browser = ActivateAndGetBrowserForUrl(url); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 reader.PopString(&vendor); | 146 reader.PopString(&vendor); |
146 reader.PopString(&product); | 147 reader.PopString(&product); |
147 ShowCloudPrintHelp(vendor, product); | 148 ShowCloudPrintHelp(vendor, product); |
148 | 149 |
149 // Send an empty response. | 150 // Send an empty response. |
150 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 151 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
151 } | 152 } |
152 | 153 |
153 } // namespace chromeos | 154 } // namespace chromeos |
154 | 155 |
OLD | NEW |