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"; |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 return true; | 40 return true; |
41 } | 41 } |
42 | 42 |
43 static ListValue* GetPlaylistItems() { | 43 static ListValue* GetPlaylistItems() { |
44 ListValue* result = new ListValue(); | 44 ListValue* result = new ListValue(); |
45 | 45 |
46 MediaPlayer::UrlVector const& src = MediaPlayer::GetInstance()->GetPlaylist(); | 46 MediaPlayer::UrlVector const& src = MediaPlayer::GetInstance()->GetPlaylist(); |
47 | 47 |
48 for (size_t i = 0; i < src.size(); i++) { | 48 for (size_t i = 0; i < src.size(); i++) { |
49 result->Append(Value::CreateStringValue(src[i].spec())); | 49 result->Append(new base::StringValue(src[i].spec())); |
50 } | 50 } |
51 return result; | 51 return result; |
52 } | 52 } |
53 | 53 |
54 bool GetPlaylistMediaplayerFunction::RunImpl() { | 54 bool GetPlaylistMediaplayerFunction::RunImpl() { |
55 DictionaryValue* result = new DictionaryValue(); | 55 DictionaryValue* result = new DictionaryValue(); |
56 MediaPlayer* player = MediaPlayer::GetInstance(); | 56 MediaPlayer* player = MediaPlayer::GetInstance(); |
57 | 57 |
58 result->Set(kPropertyItems, GetPlaylistItems()); | 58 result->Set(kPropertyItems, GetPlaylistItems()); |
59 result->SetInteger(kPropertyPosition, player->GetPlaylistPosition()); | 59 result->SetInteger(kPropertyPosition, player->GetPlaylistPosition()); |
60 | 60 |
61 SetResult(result); | 61 SetResult(result); |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 // TODO(kaznacheev): rename the API method to adjustWindowHeight here and in | 65 // TODO(kaznacheev): rename the API method to adjustWindowHeight here and in |
66 // media_player_private.json. | 66 // media_player_private.json. |
67 bool SetWindowHeightMediaplayerFunction::RunImpl() { | 67 bool SetWindowHeightMediaplayerFunction::RunImpl() { |
68 int height_diff; | 68 int height_diff; |
69 if (!args_->GetInteger(0, &height_diff)) | 69 if (!args_->GetInteger(0, &height_diff)) |
70 return false; | 70 return false; |
71 MediaPlayer::GetInstance()->AdjustWindowHeight(height_diff); | 71 MediaPlayer::GetInstance()->AdjustWindowHeight(height_diff); |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 bool CloseWindowMediaplayerFunction::RunImpl() { | 75 bool CloseWindowMediaplayerFunction::RunImpl() { |
76 MediaPlayer::GetInstance()->CloseWindow(); | 76 MediaPlayer::GetInstance()->CloseWindow(); |
77 return true; | 77 return true; |
78 } | 78 } |
OLD | NEW |