OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/usb_mount_observer.h" | 5 #include "chrome/browser/chromeos/usb_mount_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/dom_ui/filebrowse_ui.h" | 8 #include "chrome/browser/dom_ui/filebrowse_ui.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 const char* kFilebrowseURLHash = "chrome://filebrowse#"; | 19 const char* kFilebrowseURLHash = "chrome://filebrowse#"; |
20 const char* kFilebrowseScanning = "scanningdevice"; | 20 const char* kFilebrowseScanning = "scanningdevice"; |
21 const int kPopupLeft = 0; | 21 const int kPopupLeft = 0; |
22 const int kPopupTop = 0; | 22 const int kPopupTop = 0; |
23 const int kPopupWidth = 250; | 23 const int kPopupWidth = 250; |
24 const int kPopupHeight = 300; | 24 const int kPopupHeight = 300; |
25 | 25 |
| 26 // static |
| 27 USBMountObserver* USBMountObserver::Get() { |
| 28 return Singleton<USBMountObserver>::get(); |
| 29 } |
| 30 |
26 void USBMountObserver::Observe(NotificationType type, | 31 void USBMountObserver::Observe(NotificationType type, |
27 const NotificationSource& source, | 32 const NotificationSource& source, |
28 const NotificationDetails& details) { | 33 const NotificationDetails& details) { |
29 DCHECK(type == NotificationType::BROWSER_CLOSED); | 34 DCHECK(type == NotificationType::BROWSER_CLOSED); |
30 for (BrowserIterator i = browsers_.begin(); i != browsers_.end(); | 35 for (BrowserIterator i = browsers_.begin(); i != browsers_.end(); |
31 ++i) { | 36 ++i) { |
32 if (Source<Browser>(source).ptr() == i->browser) { | 37 if (Source<Browser>(source).ptr() == i->browser) { |
33 i->browser = NULL; | 38 i->browser = NULL; |
34 registrar_.Remove(this, | 39 registrar_.Remove(this, |
35 NotificationType::BROWSER_CLOSED, | 40 NotificationType::BROWSER_CLOSED, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 194 } |
190 } | 195 } |
191 for (size_t x = 0; x < close_these.size(); x++) { | 196 for (size_t x = 0; x < close_these.size(); x++) { |
192 if (close_these[x]->window()) { | 197 if (close_these[x]->window()) { |
193 close_these[x]->window()->Close(); | 198 close_these[x]->window()->Close(); |
194 } | 199 } |
195 } | 200 } |
196 } | 201 } |
197 | 202 |
198 } // namespace chromeos | 203 } // namespace chromeos |
OLD | NEW |