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

Side by Side Diff: chrome_frame/urlmon_bind_status_callback.h

Issue 1637017: With the ChromeFrame moniker patch on, the data cache maintained to indicate ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_FRAME_URLMON_BIND_STATUS_CALLBACK_H_ 5 #ifndef CHROME_FRAME_URLMON_BIND_STATUS_CALLBACK_H_
6 #define CHROME_FRAME_URLMON_BIND_STATUS_CALLBACK_H_ 6 #define CHROME_FRAME_URLMON_BIND_STATUS_CALLBACK_H_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 10
11 #include "chrome_frame/bind_status_callback_impl.h" 11 #include "chrome_frame/bind_status_callback_impl.h"
12 #include "chrome_frame/stream_impl.h" 12 #include "chrome_frame/stream_impl.h"
13 13
14 14
15 // A fake stream class to serve cached data to arbitrary 15 // A fake stream class to serve cached data to arbitrary
16 // IBindStatusCallback 16 // IBindStatusCallback
17 class CacheStream : public CComObjectRoot, public StreamImpl { 17 class CacheStream : public CComObjectRoot, public StreamImpl {
18 public: 18 public:
19 BEGIN_COM_MAP(CacheStream) 19 BEGIN_COM_MAP(CacheStream)
20 COM_INTERFACE_ENTRY(IStream) 20 COM_INTERFACE_ENTRY(IStream)
21 COM_INTERFACE_ENTRY(ISequentialStream) 21 COM_INTERFACE_ENTRY(ISequentialStream)
22 END_COM_MAP() 22 END_COM_MAP()
23 23
24 CacheStream() : cache_(NULL), size_(0), position_(0) { 24 CacheStream() : cache_(NULL), size_(0), position_(0), eof_(false) {
25 } 25 }
26 void Initialize(const char* cache, size_t size); 26 void Initialize(const char* cache, size_t size, bool eof);
27 static HRESULT BSCBFeedData(IBindStatusCallback* bscb, const char* data, 27 static HRESULT BSCBFeedData(IBindStatusCallback* bscb, const char* data,
28 size_t size, CLIPFORMAT clip_format, 28 size_t size, CLIPFORMAT clip_format,
29 size_t flags); 29 size_t flags, bool eof);
30 30
31 // IStream overrides 31 // IStream overrides
32 STDMETHOD(Read)(void* pv, ULONG cb, ULONG* read); 32 STDMETHOD(Read)(void* pv, ULONG cb, ULONG* read);
33 33
34 protected: 34 protected:
35 const char* cache_; 35 const char* cache_;
36 size_t size_; 36 size_t size_;
37 size_t position_; 37 size_t position_;
38 bool eof_;
38 39
39 private: 40 private:
40 DISALLOW_COPY_AND_ASSIGN(CacheStream); 41 DISALLOW_COPY_AND_ASSIGN(CacheStream);
41 }; 42 };
42 43
43 // Utility class for data sniffing 44 // Utility class for data sniffing
44 class SniffData { 45 class SniffData {
45 public: 46 public:
46 SniffData() : renderer_type_(OTHER), size_(0) {} 47 SniffData() : renderer_type_(OTHER), size_(0), eof_(false) {}
47 48
48 enum RendererType { 49 enum RendererType {
49 UNDETERMINED, 50 UNDETERMINED,
50 CHROME, 51 CHROME,
51 OTHER 52 OTHER
52 }; 53 };
53 54
54 bool InitializeCache(const std::wstring& url); 55 bool InitializeCache(const std::wstring& url);
55 HRESULT ReadIntoCache(IStream* stream, bool force_determination); 56 HRESULT ReadIntoCache(IStream* stream, bool force_determination);
56 HRESULT DrainCache(IBindStatusCallback* bscb, DWORD bscf, 57 HRESULT DrainCache(IBindStatusCallback* bscb, DWORD bscf,
(...skipping 18 matching lines...) Expand all
75 bool is_cache_valid() { 76 bool is_cache_valid() {
76 return (size_ != 0); 77 return (size_ != 0);
77 } 78 }
78 79
79 ScopedComPtr<IStream> cache_; 80 ScopedComPtr<IStream> cache_;
80 std::wstring url_; 81 std::wstring url_;
81 RendererType renderer_type_; 82 RendererType renderer_type_;
82 size_t size_; 83 size_t size_;
83 84
84 static const size_t kMaxSniffSize = 2 * 1024; 85 static const size_t kMaxSniffSize = 2 * 1024;
86 bool eof_;
85 87
86 private: 88 private:
87 DISALLOW_COPY_AND_ASSIGN(SniffData); 89 DISALLOW_COPY_AND_ASSIGN(SniffData);
88 }; 90 };
89 91
90 // A wrapper for bind status callback in IMoniker::BindToStorage 92 // A wrapper for bind status callback in IMoniker::BindToStorage
91 class BSCBStorageBind : public BSCBImpl { 93 class BSCBStorageBind : public BSCBImpl {
92 public: 94 public:
93 typedef BSCBImpl CallbackImpl; 95 typedef BSCBImpl CallbackImpl;
94 BSCBStorageBind() : clip_format_(CF_NULL) {} 96 BSCBStorageBind() : clip_format_(CF_NULL) {}
(...skipping 25 matching lines...) Expand all
120 }; 122 };
121 123
122 std::vector<Progress> saved_progress_; 124 std::vector<Progress> saved_progress_;
123 CLIPFORMAT clip_format_; 125 CLIPFORMAT clip_format_;
124 126
125 private: 127 private:
126 DISALLOW_COPY_AND_ASSIGN(BSCBStorageBind); 128 DISALLOW_COPY_AND_ASSIGN(BSCBStorageBind);
127 }; 129 };
128 130
129 #endif // CHROME_FRAME_URLMON_BIND_STATUS_CALLBACK_H_ 131 #endif // CHROME_FRAME_URLMON_BIND_STATUS_CALLBACK_H_
OLDNEW
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | chrome_frame/urlmon_bind_status_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698