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

Side by Side Diff: content/browser/streams/stream.h

Issue 19798012: Remove security_origin member from content::Stream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unittests Created 7 years, 5 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
« no previous file with comments | « content/browser/loader/stream_resource_handler.cc ('k') | content/browser/streams/stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_STREAMS_STREAM_H_ 5 #ifndef CONTENT_BROWSER_STREAMS_STREAM_H_
6 #define CONTENT_BROWSER_STREAMS_STREAM_H_ 6 #define CONTENT_BROWSER_STREAMS_STREAM_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 20 matching lines...) Expand all
31 // reader to consume part of the stream, then pass it along to another client 31 // reader to consume part of the stream, then pass it along to another client
32 // to continue processing the stream. 32 // to continue processing the stream.
33 class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> { 33 class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
34 public: 34 public:
35 enum StreamState { 35 enum StreamState {
36 STREAM_HAS_DATA, 36 STREAM_HAS_DATA,
37 STREAM_COMPLETE, 37 STREAM_COMPLETE,
38 STREAM_EMPTY, 38 STREAM_EMPTY,
39 }; 39 };
40 40
41 // Creates a stream useable from the |security_origin|. 41 // Creates a stream.
42 //
43 // Security origin of Streams is checked in Blink (See BlobRegistry,
44 // BlobURL and SecurityOrigin to understand how it works). There's no security
45 // origin check in Chromium side for now.
42 Stream(StreamRegistry* registry, 46 Stream(StreamRegistry* registry,
43 StreamWriteObserver* write_observer, 47 StreamWriteObserver* write_observer,
44 const GURL& security_origin,
45 const GURL& url); 48 const GURL& url);
46 49
47 // Sets the reader of this stream. Returns true on success, or false if there 50 // Sets the reader of this stream. Returns true on success, or false if there
48 // is already a reader. 51 // is already a reader.
49 bool SetReadObserver(StreamReadObserver* observer); 52 bool SetReadObserver(StreamReadObserver* observer);
50 53
51 // Removes the read observer. |observer| must be the current observer. 54 // Removes the read observer. |observer| must be the current observer.
52 void RemoveReadObserver(StreamReadObserver* observer); 55 void RemoveReadObserver(StreamReadObserver* observer);
53 56
54 // Removes the write observer. |observer| must be the current observer. 57 // Removes the write observer. |observer| must be the current observer.
(...skipping 13 matching lines...) Expand all
68 71
69 scoped_ptr<StreamHandle> CreateHandle(const GURL& original_url, 72 scoped_ptr<StreamHandle> CreateHandle(const GURL& original_url,
70 const std::string& mime_type); 73 const std::string& mime_type);
71 void CloseHandle(); 74 void CloseHandle();
72 75
73 // Indicates whether there is space in the buffer to add more data. 76 // Indicates whether there is space in the buffer to add more data.
74 bool can_add_data() const { return can_add_data_; } 77 bool can_add_data() const { return can_add_data_; }
75 78
76 const GURL& url() const { return url_; } 79 const GURL& url() const { return url_; }
77 80
78 const GURL& security_origin() const { return security_origin_; }
79
80 private: 81 private:
81 friend class base::RefCountedThreadSafe<Stream>; 82 friend class base::RefCountedThreadSafe<Stream>;
82 83
83 virtual ~Stream(); 84 virtual ~Stream();
84 85
85 void OnSpaceAvailable(); 86 void OnSpaceAvailable();
86 void OnDataAvailable(); 87 void OnDataAvailable();
87 88
88 size_t data_bytes_read_; 89 size_t data_bytes_read_;
89 bool can_add_data_; 90 bool can_add_data_;
90 91
91 GURL security_origin_;
92 GURL url_; 92 GURL url_;
93 93
94 scoped_refptr<net::IOBuffer> data_; 94 scoped_refptr<net::IOBuffer> data_;
95 size_t data_length_; 95 size_t data_length_;
96 96
97 scoped_ptr<ByteStreamWriter> writer_; 97 scoped_ptr<ByteStreamWriter> writer_;
98 scoped_ptr<ByteStreamReader> reader_; 98 scoped_ptr<ByteStreamReader> reader_;
99 99
100 StreamRegistry* registry_; 100 StreamRegistry* registry_;
101 StreamReadObserver* read_observer_; 101 StreamReadObserver* read_observer_;
102 StreamWriteObserver* write_observer_; 102 StreamWriteObserver* write_observer_;
103 103
104 StreamHandleImpl* stream_handle_; 104 StreamHandleImpl* stream_handle_;
105 105
106 base::WeakPtrFactory<Stream> weak_ptr_factory_; 106 base::WeakPtrFactory<Stream> weak_ptr_factory_;
107 DISALLOW_COPY_AND_ASSIGN(Stream); 107 DISALLOW_COPY_AND_ASSIGN(Stream);
108 }; 108 };
109 109
110 } // namespace content 110 } // namespace content
111 111
112 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_ 112 #endif // CONTENT_BROWSER_STREAMS_STREAM_H_
OLDNEW
« no previous file with comments | « content/browser/loader/stream_resource_handler.cc ('k') | content/browser/streams/stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698