| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 10 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 BrowserThread::UI, FROM_HERE, | 117 BrowserThread::UI, FROM_HERE, |
| 118 base::Bind(&MediaPlayer::PopupMediaPlayer, | 118 base::Bind(&MediaPlayer::PopupMediaPlayer, |
| 119 base::Unretained(this) /*this class is a singleton*/)); | 119 base::Unretained(this) /*this class is a singleton*/)); |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 if (mediaplayer_browser_) { // Already opened. | 122 if (mediaplayer_browser_) { // Already opened. |
| 123 mediaplayer_browser_->window()->Show(); | 123 mediaplayer_browser_->window()->Show(); |
| 124 return; | 124 return; |
| 125 } | 125 } |
| 126 | 126 |
| 127 const gfx::Size screen = gfx::Screen::GetPrimaryMonitorSize(); | 127 const gfx::Size screen = gfx::Screen::GetPrimaryMonitor().size(); |
| 128 const gfx::Rect bounds(screen.width() - kPopupRight - kPopupWidth, | 128 const gfx::Rect bounds(screen.width() - kPopupRight - kPopupWidth, |
| 129 screen.height() - kPopupBottom - kPopupHeight, | 129 screen.height() - kPopupBottom - kPopupHeight, |
| 130 kPopupWidth, | 130 kPopupWidth, |
| 131 kPopupHeight); | 131 kPopupHeight); |
| 132 | 132 |
| 133 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 133 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 134 mediaplayer_browser_ = Browser::CreateWithParams( | 134 mediaplayer_browser_ = Browser::CreateWithParams( |
| 135 Browser::CreateParams::CreateForApp(Browser::TYPE_PANEL, | 135 Browser::CreateParams::CreateForApp(Browser::TYPE_PANEL, |
| 136 kMediaPlayerAppName, | 136 kMediaPlayerAppName, |
| 137 bounds, | 137 bounds, |
| 138 profile)); | 138 profile)); |
| 139 registrar_.Add(this, | 139 registrar_.Add(this, |
| 140 chrome::NOTIFICATION_BROWSER_CLOSED, | 140 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 141 content::Source<Browser>(mediaplayer_browser_)); | 141 content::Source<Browser>(mediaplayer_browser_)); |
| 142 | 142 |
| 143 mediaplayer_browser_->AddSelectedTabWithURL(GetMediaPlayerUrl(), | 143 mediaplayer_browser_->AddSelectedTabWithURL(GetMediaPlayerUrl(), |
| 144 content::PAGE_TRANSITION_LINK); | 144 content::PAGE_TRANSITION_LINK); |
| 145 mediaplayer_browser_->window()->Show(); | 145 mediaplayer_browser_->window()->Show(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 GURL MediaPlayer::GetMediaPlayerUrl() const { | 148 GURL MediaPlayer::GetMediaPlayerUrl() const { |
| 149 return file_manager_util::GetMediaPlayerUrl(); | 149 return file_manager_util::GetMediaPlayerUrl(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 MediaPlayer::MediaPlayer() | 152 MediaPlayer::MediaPlayer() |
| 153 : current_position_(0), | 153 : current_position_(0), |
| 154 mediaplayer_browser_(NULL) { | 154 mediaplayer_browser_(NULL) { |
| 155 }; | 155 }; |
| OLD | NEW |