Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: chrome/browser/chromeos/media/media_player.cc

Issue 11269043: Make the title of Chrome OS Audio Player empty (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a test Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/media/media_player.cc
diff --git a/chrome/browser/chromeos/media/media_player.cc b/chrome/browser/chromeos/media/media_player.cc
index ef558cfaf14aa7bcb137a2439d654cd842be5022..2cd345d428414bb7a169c4b5dc2e769df2ea322c 100644
--- a/chrome/browser/chromeos/media/media_player.cc
+++ b/chrome/browser/chromeos/media/media_player.cc
@@ -27,7 +27,6 @@
#include "ui/gfx/screen.h"
using content::BrowserThread;
-using content::UserMetricsAction;
static const char* kMediaPlayerAppName = "mediaplayer";
static const int kPopupRight = 20;
@@ -39,7 +38,8 @@ static const int kPopupWidth = 280;
// SetWindowHeight will be called soon after the popup creation with the correct
// height which will cause a nice slide-up animation.
// TODO(kaznacheev): Remove kTitleHeight when MediaPlayer becomes chromeless.
-static const int kTitleHeight = 24;
+// kTitleHeight is an approximate value. May be different for touch-enabled UI.
+static const int kTitleHeight = 35;
static const int kTrackHeight = 58;
static const int kControlsHeight = 35;
static const int kPopupHeight = kTitleHeight + kTrackHeight + kControlsHeight;
@@ -66,11 +66,15 @@ MediaPlayer* MediaPlayer::GetInstance() {
return Singleton<MediaPlayer>::get();
}
-void MediaPlayer::SetWindowHeight(int content_height) {
+// The client knows how high the client part of the window should be but
+// cannot translate it to the window height (because the window title bar height
+// is unknown). Instead it passes the height difference which this method
+// applies to the window height.
+void MediaPlayer::AdjustWindowHeight(int height_diff) {
Browser* browser = GetBrowser();
if (browser != NULL) {
- int window_height = content_height + kTitleHeight;
gfx::Rect bounds = browser->window()->GetBounds();
+ int window_height = bounds.height() + height_diff;
browser->window()->SetBounds(gfx::Rect(
bounds.x(),
std::max(0, bounds.bottom() - window_height),
@@ -128,11 +132,10 @@ void MediaPlayer::PopupMediaPlayer() {
kPopupHeight);
Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
- browser = new Browser(
- Browser::CreateParams::CreateForApp(Browser::TYPE_PANEL,
- kMediaPlayerAppName,
- bounds,
- profile));
+ Browser::CreateParams params(Browser::TYPE_POPUP, profile);
+ params.app_name = kMediaPlayerAppName;
+ params.initial_bounds = bounds;
+ browser = new Browser(params);
chrome::AddSelectedTabWithURL(browser, GetMediaPlayerUrl(),
content::PAGE_TRANSITION_LINK);
« no previous file with comments | « chrome/browser/chromeos/media/media_player.h ('k') | chrome/browser/chromeos/media/media_player_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698