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/session_state_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const char kCloudPrintLearnUrl[] = | 41 const char kCloudPrintLearnUrl[] = |
42 "https://www.google.com/landing/cloudprint/index.html"; | 42 "https://www.google.com/landing/cloudprint/index.html"; |
43 | 43 |
44 void ActivateContents(Browser* browser, content::WebContents* contents) { | 44 void ActivateContents(Browser* browser, content::WebContents* contents) { |
45 browser->tab_strip_model()->ActivateTabAt( | 45 browser->tab_strip_model()->ActivateTabAt( |
46 browser->tab_strip_model()->GetIndexOfWebContents(contents), false); | 46 browser->tab_strip_model()->GetIndexOfWebContents(contents), false); |
47 } | 47 } |
48 | 48 |
49 Browser* ActivateAndGetBrowserForUrl(GURL url) { | 49 Browser* ActivateAndGetBrowserForUrl(GURL url) { |
50 for (TabContentsIterator it; !it.done(); it.Next()) { | 50 for (TabContentsIterator it; !it.done(); it.Next()) { |
51 if (it->GetURL() == url) { | 51 if (it->GetLastCommittedURL() == url) { |
52 ActivateContents(it.browser(), *it); | 52 ActivateContents(it.browser(), *it); |
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, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 reader.PopString(&vendor); | 146 reader.PopString(&vendor); |
147 reader.PopString(&product); | 147 reader.PopString(&product); |
148 ShowCloudPrintHelp(vendor, product); | 148 ShowCloudPrintHelp(vendor, product); |
149 | 149 |
150 // Send an empty response. | 150 // Send an empty response. |
151 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 151 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
152 } | 152 } |
153 | 153 |
154 } // namespace chromeos | 154 } // namespace chromeos |
155 | 155 |
OLD | NEW |