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

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

Issue 11638024: Make MediaPlayerEventRouter a PKS to decouple it from ExtensionService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch rebased Created 7 years, 11 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_extension_api.cc
diff --git a/chrome/browser/chromeos/media/media_player_extension_api.cc b/chrome/browser/chromeos/media/media_player_extension_api.cc
deleted file mode 100644
index 1f8449f5c02751bae13e8b96f286e89770c10e36..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/media/media_player_extension_api.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/values.h"
-#include "chrome/browser/chromeos/media/media_player.h"
-#include "chrome/browser/chromeos/media/media_player_extension_api.h"
-
-static const char kPropertyItems[] = "items";
-static const char kPropertyPosition[] = "position";
-
-bool PlayMediaplayerFunction::RunImpl() {
- if (args_->GetSize() < 2) {
- return false;
- }
-
- ListValue* url_list = NULL;
- if (!args_->GetList(0, &url_list))
- return false;
-
- int position;
- if (!args_->GetInteger(1, &position))
- return false;
-
- MediaPlayer* player = MediaPlayer::GetInstance();
-
- player->PopupMediaPlayer();
- player->ClearPlaylist();
-
- size_t len = url_list->GetSize();
- for (size_t i = 0; i < len; ++i) {
- std::string path;
- url_list->GetString(i, &path);
- player->EnqueueMediaFileUrl(GURL(path));
- }
-
- player->SetPlaylistPosition(position);
- player->NotifyPlaylistChanged();
-
- return true;
-}
-
-static ListValue* GetPlaylistItems() {
- ListValue* result = new ListValue();
-
- MediaPlayer::UrlVector const& src = MediaPlayer::GetInstance()->GetPlaylist();
-
- for (size_t i = 0; i < src.size(); i++) {
- result->Append(new base::StringValue(src[i].spec()));
- }
- return result;
-}
-
-bool GetPlaylistMediaplayerFunction::RunImpl() {
- DictionaryValue* result = new DictionaryValue();
- MediaPlayer* player = MediaPlayer::GetInstance();
-
- result->Set(kPropertyItems, GetPlaylistItems());
- result->SetInteger(kPropertyPosition, player->GetPlaylistPosition());
-
- SetResult(result);
- return true;
-}
-
-// TODO(kaznacheev): rename the API method to adjustWindowHeight here and in
-// media_player_private.json.
-bool SetWindowHeightMediaplayerFunction::RunImpl() {
- int height_diff;
- if (!args_->GetInteger(0, &height_diff))
- return false;
- MediaPlayer::GetInstance()->AdjustWindowHeight(height_diff);
- return true;
-}
-
-bool CloseWindowMediaplayerFunction::RunImpl() {
- MediaPlayer::GetInstance()->CloseWindow();
- return true;
-}
« no previous file with comments | « chrome/browser/chromeos/media/media_player_extension_api.h ('k') | chrome/browser/extensions/extension_function_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698