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

Side by Side Diff: chrome/browser/component_updater/component_updater_service.cc

Issue 42003002: Extract supported codecs from CDM component manifest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use constant; support existing manifests Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/component_updater/component_updater_service.h" 5 #include "chrome/browser/component_updater/component_updater_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/json/json_file_value_serializer.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "base/stl_util.h" 19 #include "base/stl_util.h"
19 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_piece.h" 21 #include "base/strings/string_piece.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "base/timer/timer.h" 24 #include "base/timer/timer.h"
24 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/component_updater/component_patcher.h" 26 #include "chrome/browser/component_updater/component_patcher.h"
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 } 1002 }
1002 } 1003 }
1003 1004
1004 // The component update factory. Using the component updater as a singleton 1005 // The component update factory. Using the component updater as a singleton
1005 // is the job of the browser process. 1006 // is the job of the browser process.
1006 ComponentUpdateService* ComponentUpdateServiceFactory( 1007 ComponentUpdateService* ComponentUpdateServiceFactory(
1007 ComponentUpdateService::Configurator* config) { 1008 ComponentUpdateService::Configurator* config) {
1008 DCHECK(config); 1009 DCHECK(config);
1009 return new CrxUpdateService(config); 1010 return new CrxUpdateService(config);
1010 } 1011 }
1012
1013 // TODO(cpu): add a specific attribute check to a component json that the
1014 // extension unpacker will reject, so that a component cannot be installed
1015 // as an extension.
1016 base::DictionaryValue* ReadComponentManifest(
1017 const base::FilePath& unpack_path) {
1018 base::FilePath manifest =
1019 unpack_path.Append(FILE_PATH_LITERAL("manifest.json"));
1020 if (!base::PathExists(manifest))
1021 return NULL;
1022 JSONFileValueSerializer serializer(manifest);
1023 std::string error;
1024 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, &error));
1025 if (!root.get()) {
1026 DLOG(ERROR) << "Failed to deserialize " << manifest.MaybeAsASCII() << ": "
1027 << error;
1028 return NULL;
1029 }
1030 if (!root->IsType(base::Value::TYPE_DICTIONARY)) {
1031 return NULL;
1032 }
1033 return static_cast<base::DictionaryValue*>(root.release());
xhwang 2013/10/25 17:33:22 hmm, It'll be nice if we can return a scoped_ptr h
ddorwin 2013/10/25 19:03:40 I independently came up with that same long return
1034 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698