| 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 "base/values.h" | 5 #include "base/values.h" |
| 6 #include "chrome/browser/chromeos/media/media_player.h" | 6 #include "chrome/browser/chromeos/media/media_player.h" |
| 7 #include "chrome/browser/chromeos/media/media_player_extension_api.h" | 7 #include "chrome/browser/chromeos/media/media_player_extension_api.h" |
| 8 | 8 |
| 9 static const char kPropertyItems[] = "items"; | 9 static const char kPropertyItems[] = "items"; |
| 10 static const char kPropertyPosition[] = "position"; | 10 static const char kPropertyPosition[] = "position"; |
| 11 | 11 |
| 12 bool PlayMediaplayerFunction::RunImpl() { | 12 bool PlayMediaplayerFunction::RunImpl() { |
| 13 if (args_->GetSize() < 2) { | 13 if (args_->GetSize() < 2) { |
| 14 return false; | 14 return false; |
| 15 } | 15 } |
| 16 | 16 |
| 17 ListValue* url_list = NULL; | 17 ListValue* url_list = NULL; |
| 18 if (!args_->GetList(0, &url_list)) | 18 if (!args_->GetList(0, &url_list)) |
| 19 return false; | 19 return false; |
| 20 | 20 |
| 21 int position; | 21 int position; |
| 22 if (!args_->GetInteger(1, &position)) | 22 if (!args_->GetInteger(1, &position)) |
| 23 return false; | 23 return false; |
| 24 | 24 |
| 25 MediaPlayer* player = MediaPlayer::GetInstance(); | 25 MediaPlayer* player = MediaPlayer::GetInstance(); |
| 26 | 26 |
| 27 player->PopupMediaPlayer(NULL); | 27 player->PopupMediaPlayer(); |
| 28 player->ClearPlaylist(); | 28 player->ClearPlaylist(); |
| 29 | 29 |
| 30 size_t len = url_list->GetSize(); | 30 size_t len = url_list->GetSize(); |
| 31 for (size_t i = 0; i < len; ++i) { | 31 for (size_t i = 0; i < len; ++i) { |
| 32 std::string path; | 32 std::string path; |
| 33 url_list->GetString(i, &path); | 33 url_list->GetString(i, &path); |
| 34 player->EnqueueMediaFileUrl(GURL(path)); | 34 player->EnqueueMediaFileUrl(GURL(path)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 player->SetPlaylistPosition(position); | 37 player->SetPlaylistPosition(position); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 67 if (!args_->GetInteger(0, &height)) | 67 if (!args_->GetInteger(0, &height)) |
| 68 return false; | 68 return false; |
| 69 MediaPlayer::GetInstance()->SetWindowHeight(height); | 69 MediaPlayer::GetInstance()->SetWindowHeight(height); |
| 70 return true; | 70 return true; |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool CloseWindowMediaplayerFunction::RunImpl() { | 73 bool CloseWindowMediaplayerFunction::RunImpl() { |
| 74 MediaPlayer::GetInstance()->CloseWindow(); | 74 MediaPlayer::GetInstance()->CloseWindow(); |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| OLD | NEW |