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

Side by Side Diff: chrome/browser/guestview/guestview.h

Issue 27408004: <webview>: Resolve relative paths as chrome-extension: URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed creis's comments Created 7 years, 1 month 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
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 CHROME_BROWSER_GUESTVIEW_GUESTVIEW_H_ 5 #ifndef CHROME_BROWSER_GUESTVIEW_GUESTVIEW_H_
6 #define CHROME_BROWSER_GUESTVIEW_GUESTVIEW_H_ 6 #define CHROME_BROWSER_GUESTVIEW_GUESTVIEW_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 24 matching lines...) Expand all
35 35
36 scoped_ptr<DictionaryValue> GetArguments(); 36 scoped_ptr<DictionaryValue> GetArguments();
37 37
38 private: 38 private:
39 const std::string event_name_; 39 const std::string event_name_;
40 scoped_ptr<DictionaryValue> args_; 40 scoped_ptr<DictionaryValue> args_;
41 }; 41 };
42 42
43 static Type GetViewTypeFromString(const std::string& api_type); 43 static Type GetViewTypeFromString(const std::string& api_type);
44 44
45 static GuestView* Create(content::WebContents* guest_web_contents, 45 static GuestView* Create(content::WebContents* guest_web_contents,
Charlie Reis 2013/10/29 21:11:39 This should have a comment explaining both extensi
Fady Samuel 2013/10/30 19:48:52 I've refactored things a bit to make it so that ex
46 const std::string& extension_id,
46 Type view_type); 47 Type view_type);
47 48
48 static GuestView* FromWebContents(content::WebContents* web_contents); 49 static GuestView* FromWebContents(content::WebContents* web_contents);
49 50
50 static GuestView* From(int embedder_process_id, int instance_id); 51 static GuestView* From(int embedder_process_id, int instance_id);
51 52
52 virtual void Attach(content::WebContents* embedder_web_contents, 53 virtual void Attach(content::WebContents* embedder_web_contents,
53 const std::string& extension_id, 54 const std::string& extension_id,
54 const base::DictionaryValue& args); 55 const base::DictionaryValue& args);
55 56
(...skipping 26 matching lines...) Expand all
82 // Returns the extension ID of the embedder. 83 // Returns the extension ID of the embedder.
83 const std::string& extension_id() const { return extension_id_; } 84 const std::string& extension_id() const { return extension_id_; }
84 85
85 // Returns the user browser context of the embedder. 86 // Returns the user browser context of the embedder.
86 content::BrowserContext* browser_context() const { return browser_context_; } 87 content::BrowserContext* browser_context() const { return browser_context_; }
87 88
88 // Returns the embedder's process ID. 89 // Returns the embedder's process ID.
89 int embedder_render_process_id() const { return embedder_render_process_id_; } 90 int embedder_render_process_id() const { return embedder_render_process_id_; }
90 91
91 protected: 92 protected:
92 explicit GuestView(content::WebContents* guest_web_contents); 93 GuestView(content::WebContents* guest_web_contents,
94 const std::string& extension_id);
93 virtual ~GuestView(); 95 virtual ~GuestView();
94 96
95 // Dispatches an event |event_name| to the embedder with the |event| fields. 97 // Dispatches an event |event_name| to the embedder with the |event| fields.
96 void DispatchEvent(Event* event); 98 void DispatchEvent(Event* event);
97 99
98 private: 100 private:
99 void SendQueuedEvents(); 101 void SendQueuedEvents();
100 102
101 content::WebContents* guest_web_contents_; 103 content::WebContents* guest_web_contents_;
102 content::WebContents* embedder_web_contents_; 104 content::WebContents* embedder_web_contents_;
103 std::string extension_id_; 105 std::string extension_id_;
104 int embedder_render_process_id_; 106 int embedder_render_process_id_;
105 content::BrowserContext* browser_context_; 107 content::BrowserContext* browser_context_;
106 // |guest_instance_id_| is a profile-wide unique identifier for a guest 108 // |guest_instance_id_| is a profile-wide unique identifier for a guest
107 // WebContents. 109 // WebContents.
108 const int guest_instance_id_; 110 const int guest_instance_id_;
109 // |view_instance_id_| is an identifier that's unique within a particular 111 // |view_instance_id_| is an identifier that's unique within a particular
110 // embedder RenderViewHost for a particular <*view> instance. 112 // embedder RenderViewHost for a particular <*view> instance.
111 int view_instance_id_; 113 int view_instance_id_;
112 114
113 // This is a queue of Events that are destined to be sent to the embedder once 115 // This is a queue of Events that are destined to be sent to the embedder once
114 // the guest is attached to a particular embedder. 116 // the guest is attached to a particular embedder.
115 std::queue<Event*> pending_events_; 117 std::queue<Event*> pending_events_;
116 118
117 DISALLOW_COPY_AND_ASSIGN(GuestView); 119 DISALLOW_COPY_AND_ASSIGN(GuestView);
118 }; 120 };
119 121
120 #endif // CHROME_BROWSER_GUESTVIEW_GUESTVIEW_H_ 122 #endif // CHROME_BROWSER_GUESTVIEW_GUESTVIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698