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

Side by Side Diff: webkit/glue/media/media_resource_loader_bridge_factory.h

Issue 5756004: Separate BufferedDataSource and BufferedResourceLoader into two files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: inlining + removing Is...Protocol methods and getting rid of GetBufferedFirstBytePosition Created 10 years 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
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_MEDIA_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
6 #define WEBKIT_GLUE_MEDIA_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
7
8 #include "base/gtest_prod_util.h"
9 #include "webkit/glue/resource_loader_bridge.h"
10
11 namespace webkit_glue {
12
13 // A factory used to create a ResourceLoaderBridge for the media player.
14 // This factory is used also for testing. Testing code can use this class and
15 // override CreateBridge() to inject a mock ResourceLoaderBridge for code that
16 // interacts with it, e.g. BufferedDataSource.
17 class MediaResourceLoaderBridgeFactory {
18 public:
19 MediaResourceLoaderBridgeFactory(
20 const GURL& referrer,
21 const std::string& frame_origin,
22 const std::string& main_frame_origin,
23 int origin_pid,
24 int appcache_host_id,
25 int32 routing_id);
26
27 virtual ~MediaResourceLoaderBridgeFactory();
28
29 // Factory method to create a ResourceLoaderBridge with the following
30 // parameters:
31 // |url| - URL of the resource to be loaded.
32 // |load_flags| - Load flags for this loading.
33 // |first_byte_position| - First byte position for a range request, -1 if not.
34 // |last_byte_position| - Last byte position for a range request, -1 if not.
35 virtual ResourceLoaderBridge* CreateBridge(
36 const GURL& url,
37 int load_flags,
38 int64 first_byte_position,
39 int64 last_byte_position);
40
41 protected:
42 // An empty constructor only used by inherited classes.
43 MediaResourceLoaderBridgeFactory();
44
45 private:
46 FRIEND_TEST_ALL_PREFIXES(MediaResourceLoaderBridgeFactoryTest,
47 GenerateHeaders);
48
49 // Returns a range request header using parameters |first_byte_position| and
50 // |last_byte_position|.
51 // Negative numbers other than -1 are not allowed for |first_byte_position|
52 // and |last_byte_position|. |first_byte_position| should always be less than
53 // or equal to |last_byte_position| if they are both not -1.
54 // Here's a list of valid parameters:
55 // |first_byte_position| |last_byte_position|
56 // 0 1000
57 // 4096 4096
58 // 0 -1
59 // -1 -1
60 // Empty string is returned on invalid parameters.
61 static const std::string GenerateHeaders(int64 first_byte_position,
62 int64 last_byte_position);
63
64 GURL first_party_for_cookies_;
65 GURL referrer_;
66 std::string frame_origin_;
67 std::string main_frame_origin_;
68 std::string headers_;
69 int origin_pid_;
70 int appcache_host_id_;
71 int32 routing_id_;
72 };
73
74 } // namespace webkit_glue
75
76 #endif // WEBKIT_GLUE_MEDIA_MEDIA_RESOURCE_LOADER_BRIDGE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698