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

Side by Side Diff: extensions/renderer/extension_frame_helper.h

Issue 1225413002: [Extensions] Fix improper extension tab ownership bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « extensions/common/extension_messages.h ('k') | extensions/renderer/extension_frame_helper.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ 5 #ifndef EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_
6 #define EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ 6 #define EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "content/public/common/console_message_level.h" 10 #include "content/public/common/console_message_level.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Returns true if the given |context| is for any frame in the extension's 50 // Returns true if the given |context| is for any frame in the extension's
51 // event page. 51 // event page.
52 // TODO(devlin): This isn't really used properly, and should probably be 52 // TODO(devlin): This isn't really used properly, and should probably be
53 // deleted. 53 // deleted.
54 static bool IsContextForEventPage(const ScriptContext* context); 54 static bool IsContextForEventPage(const ScriptContext* context);
55 55
56 ViewType view_type() const { return view_type_; } 56 ViewType view_type() const { return view_type_; }
57 int tab_id() const { return tab_id_; } 57 int tab_id() const { return tab_id_; }
58 int browser_window_id() const { return browser_window_id_; } 58 int browser_window_id() const { return browser_window_id_; }
59 const std::string& tab_extension_owner_id() const {
60 return tab_extension_owner_id_;
61 }
62 59
63 private: 60 private:
64 // RenderFrameObserver implementation. 61 // RenderFrameObserver implementation.
65 void DidCreateDocumentElement() override; 62 void DidCreateDocumentElement() override;
66 void DidMatchCSS( 63 void DidMatchCSS(
67 const blink::WebVector<blink::WebString>& newly_matching_selectors, 64 const blink::WebVector<blink::WebString>& newly_matching_selectors,
68 const blink::WebVector<blink::WebString>& stopped_matching_selectors) 65 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
69 override; 66 override;
70 void DidCreateScriptContext(v8::Local<v8::Context>, 67 void DidCreateScriptContext(v8::Local<v8::Context>,
71 int extension_group, 68 int extension_group,
72 int world_id) override; 69 int world_id) override;
73 void WillReleaseScriptContext(v8::Local<v8::Context>, int world_id) override; 70 void WillReleaseScriptContext(v8::Local<v8::Context>, int world_id) override;
74 bool OnMessageReceived(const IPC::Message& message) override; 71 bool OnMessageReceived(const IPC::Message& message) override;
75 72
76 // IPC handlers. 73 // IPC handlers.
77 void OnExtensionDispatchOnConnect( 74 void OnExtensionDispatchOnConnect(
78 int target_port_id, 75 int target_port_id,
79 const std::string& channel_name, 76 const std::string& channel_name,
80 const ExtensionMsg_TabConnectionInfo& source, 77 const ExtensionMsg_TabConnectionInfo& source,
81 const ExtensionMsg_ExternalConnectionInfo& info, 78 const ExtensionMsg_ExternalConnectionInfo& info,
82 const std::string& tls_channel_id); 79 const std::string& tls_channel_id);
83 void OnExtensionDeliverMessage(int target_port_id, 80 void OnExtensionDeliverMessage(int target_port_id,
84 const Message& message); 81 const Message& message);
85 void OnExtensionDispatchOnDisconnect(int port_id, 82 void OnExtensionDispatchOnDisconnect(int port_id,
86 const std::string& error_message); 83 const std::string& error_message);
87 void OnExtensionSetTabId(int tab_id); 84 void OnExtensionSetTabId(int tab_id);
88 void OnSetMainFrameExtensionOwner(const std::string& extension_id);
89 void OnUpdateBrowserWindowId(int browser_window_id); 85 void OnUpdateBrowserWindowId(int browser_window_id);
90 void OnNotifyRendererViewType(ViewType view_type); 86 void OnNotifyRendererViewType(ViewType view_type);
91 void OnExtensionResponse(int request_id, 87 void OnExtensionResponse(int request_id,
92 bool success, 88 bool success,
93 const base::ListValue& response, 89 const base::ListValue& response,
94 const std::string& error); 90 const std::string& error);
95 void OnExtensionMessageInvoke(const std::string& extension_id, 91 void OnExtensionMessageInvoke(const std::string& extension_id,
96 const std::string& module_name, 92 const std::string& module_name,
97 const std::string& function_name, 93 const std::string& function_name,
98 const base::ListValue& args, 94 const base::ListValue& args,
99 bool user_gesture); 95 bool user_gesture);
100 96
101 // Type of view associated with the RenderFrame. 97 // Type of view associated with the RenderFrame.
102 ViewType view_type_; 98 ViewType view_type_;
103 99
104 // The id of the tab the render frame is attached to. 100 // The id of the tab the render frame is attached to.
105 int tab_id_; 101 int tab_id_;
106 102
107 // The id of the browser window the render frame is attached to. 103 // The id of the browser window the render frame is attached to.
108 int browser_window_id_; 104 int browser_window_id_;
109 105
110 // The id of the extension that "owns" the tab if this is a chrome-extension
111 // page. If it's not a chrome-extension page, |tab_extension_owner_id_| is
112 // empty.
113 std::string tab_extension_owner_id_;
114
115 Dispatcher* extension_dispatcher_; 106 Dispatcher* extension_dispatcher_;
116 107
117 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper); 108 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper);
118 }; 109 };
119 110
120 } // namespace extensions 111 } // namespace extensions
121 112
122 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_ 113 #endif // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_
OLDNEW
« no previous file with comments | « extensions/common/extension_messages.h ('k') | extensions/renderer/extension_frame_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698