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/media/media_player.h" | 5 #include "chrome/browser/chromeos/media/media_player.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 11 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
12 #include "chrome/browser/chromeos/extensions/media_player_api.h" | 12 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
13 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 13 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_iterator.h" |
18 #include "chrome/browser/ui/browser_tabstrip.h" | 18 #include "chrome/browser/ui/browser_tabstrip.h" |
19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
25 | 25 |
26 using content::BrowserThread; | 26 using content::BrowserThread; |
27 | 27 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 content::PAGE_TRANSITION_LINK); | 146 content::PAGE_TRANSITION_LINK); |
147 } | 147 } |
148 browser->window()->Show(); | 148 browser->window()->Show(); |
149 } | 149 } |
150 | 150 |
151 GURL MediaPlayer::GetMediaPlayerUrl() { | 151 GURL MediaPlayer::GetMediaPlayerUrl() { |
152 return file_manager_util::GetMediaPlayerUrl(); | 152 return file_manager_util::GetMediaPlayerUrl(); |
153 } | 153 } |
154 | 154 |
155 Browser* MediaPlayer::GetBrowser() { | 155 Browser* MediaPlayer::GetBrowser() { |
156 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); | 156 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
157 browser_iterator != BrowserList::end(); ++browser_iterator) { | 157 Browser* browser = *it; |
158 Browser* browser = *browser_iterator; | |
159 TabStripModel* tab_strip = browser->tab_strip_model(); | 158 TabStripModel* tab_strip = browser->tab_strip_model(); |
160 for (int idx = 0; idx < tab_strip->count(); idx++) { | 159 for (int idx = 0; idx < tab_strip->count(); idx++) { |
161 const GURL& url = tab_strip->GetWebContentsAt(idx)->GetURL(); | 160 const GURL& url = tab_strip->GetWebContentsAt(idx)->GetURL(); |
162 GURL base_url(url.GetOrigin().spec() + url.path().substr(1)); | 161 GURL base_url(url.GetOrigin().spec() + url.path().substr(1)); |
163 if (base_url == GetMediaPlayerUrl()) | 162 if (base_url == GetMediaPlayerUrl()) |
164 return browser; | 163 return browser; |
165 } | 164 } |
166 } | 165 } |
167 return NULL; | 166 return NULL; |
168 } | 167 } |
169 | 168 |
170 MediaPlayer::MediaPlayer() | 169 MediaPlayer::MediaPlayer() |
171 : current_position_(0) { | 170 : current_position_(0) { |
172 }; | 171 }; |
OLD | NEW |