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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.h

Issue 10912054: Adding parsing for partition and persistence attributes to the <browser> tag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
7 7
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/sequenced_task_runner_helpers.h" 11 #include "base/sequenced_task_runner_helpers.h"
12 #include "content/renderer/browser_plugin/browser_plugin_backing_store.h" 12 #include "content/renderer/browser_plugin/browser_plugin_backing_store.h"
13 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" 13 #include "content/renderer/browser_plugin/browser_plugin_bindings.h"
14 #include "content/renderer/render_view_impl.h" 14 #include "content/renderer/render_view_impl.h"
15 15
16 struct BrowserPluginMsg_UpdateRect_Params; 16 struct BrowserPluginMsg_UpdateRect_Params;
17 17
18 namespace content { 18 namespace content {
19 19
20 class BrowserPluginManager; 20 class BrowserPluginManager;
21 class MockBrowserPlugin; 21 class MockBrowserPlugin;
22 22
23 class CONTENT_EXPORT BrowserPlugin : 23 class CONTENT_EXPORT BrowserPlugin :
24 NON_EXPORTED_BASE(public WebKit::WebPlugin) { 24 NON_EXPORTED_BASE(public WebKit::WebPlugin) {
25 public: 25 public:
26 enum BoolAttribute {
michaeln 2012/09/10 23:01:43 Doesn't look like this needs to be public. Actuall
nasko 2012/09/10 23:16:08 We want to raise an exception if JavaScript is use
27 UNSET_VALUE = -1,
28 FALSE_VALUE,
29 TRUE_VALUE
30 };
31
26 // Called only by tests to clean up before we blow away the MockRenderProcess. 32 // Called only by tests to clean up before we blow away the MockRenderProcess.
27 void Cleanup(); 33 void Cleanup();
28 34
29 // Get the src attribute value of the BrowserPlugin instance if the guest 35 // Get the src attribute value of the BrowserPlugin instance if the guest
30 // has not crashed. 36 // has not crashed.
31 std::string GetSrcAttribute() const; 37 std::string GetSrcAttribute() const;
32 // Set the src attribute value of the BrowserPlugin instance and reset 38 // Set the src attribute value of the BrowserPlugin instance and reset
33 // the guest_crashed_ flag. 39 // the guest_crashed_ flag.
34 void SetSrcAttribute(const std::string& src); 40 void SetSrcAttribute(const std::string& src);
35 41
42 std::string GetPartitionAttribute() const;
43 bool SetPartitionAttribute(const std::string& partition_id);
44
45 bool GetPersistAttribute() const;
46 bool SetPersistAttribute(bool persist);
47
36 // Inform the BrowserPlugin to update its backing store with the pixels in 48 // Inform the BrowserPlugin to update its backing store with the pixels in
37 // its damage buffer. 49 // its damage buffer.
38 void UpdateRect(int message_id, 50 void UpdateRect(int message_id,
39 const BrowserPluginMsg_UpdateRect_Params& params); 51 const BrowserPluginMsg_UpdateRect_Params& params);
40 // Inform the BrowserPlugin that its guest has crashed. 52 // Inform the BrowserPlugin that its guest has crashed.
41 void GuestCrashed(); 53 void GuestCrashed();
42 // Informs the BrowserPlugin that the guest has navigated to a new URL. 54 // Informs the BrowserPlugin that the guest has navigated to a new URL.
43 void DidNavigate(const GURL& url); 55 void DidNavigate(const GURL& url);
44 // Tells the BrowserPlugin to advance the focus to the next (or previous) 56 // Tells the BrowserPlugin to advance the focus to the next (or previous)
45 // element. 57 // element.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const WebKit::WebPluginParams& params); 121 const WebKit::WebPluginParams& params);
110 122
111 virtual ~BrowserPlugin(); 123 virtual ~BrowserPlugin();
112 124
113 int width() const { return plugin_rect_.width(); } 125 int width() const { return plugin_rect_.width(); }
114 int height() const { return plugin_rect_.height(); } 126 int height() const { return plugin_rect_.height(); }
115 127
116 // Virtual to allow for mocking in tests. 128 // Virtual to allow for mocking in tests.
117 virtual float GetDeviceScaleFactor() const; 129 virtual float GetDeviceScaleFactor() const;
118 130
119 // Parses the source URL of the browser plugin from the element's attributes 131 // Parses the attributes of the browser plugin from the element's attributes
120 // and outputs them. 132 // and sets them appropriately.
121 bool ParseSrcAttribute(const WebKit::WebPluginParams& params, 133 void ParseAttributes(const WebKit::WebPluginParams& params);
122 std::string* src);
123 134
124 // Cleanup event listener state to free v8 resources when a BrowserPlugin 135 // Cleanup event listener state to free v8 resources when a BrowserPlugin
125 // is destroyed. 136 // is destroyed.
126 void RemoveEventListeners(); 137 void RemoveEventListeners();
127 138
128 int instance_id_; 139 int instance_id_;
129 RenderViewImpl* render_view_; 140 RenderViewImpl* render_view_;
130 WebKit::WebPluginContainer* container_; 141 WebKit::WebPluginContainer* container_;
131 scoped_ptr<BrowserPluginBindings> bindings_; 142 scoped_ptr<BrowserPluginBindings> bindings_;
132 scoped_ptr<BrowserPluginBackingStore> backing_store_; 143 scoped_ptr<BrowserPluginBackingStore> backing_store_;
133 TransportDIB* damage_buffer_; 144 TransportDIB* damage_buffer_;
134 gfx::Rect plugin_rect_; 145 gfx::Rect plugin_rect_;
135 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. 146 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer.
136 SkBitmap* sad_guest_; 147 SkBitmap* sad_guest_;
137 bool guest_crashed_; 148 bool guest_crashed_;
138 bool resize_pending_; 149 bool resize_pending_;
139 long long parent_frame_; 150 long long parent_frame_;
151 bool has_navigated_;
140 std::string src_; 152 std::string src_;
153 std::string partition_id_;
154 BoolAttribute persist_storage_;
141 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; 155 typedef std::vector<v8::Persistent<v8::Function> > EventListeners;
142 typedef std::map<std::string, EventListeners> EventListenerMap; 156 typedef std::map<std::string, EventListeners> EventListenerMap;
143 EventListenerMap event_listener_map_; 157 EventListenerMap event_listener_map_;
144 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 158 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
145 }; 159 };
146 160
147 } // namespace content 161 } // namespace content
148 162
149 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 163 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin.cc » ('j') | content/renderer/browser_plugin/browser_plugin.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698