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

Side by Side Diff: chrome/browser/adview/adview_guest.h

Issue 17165004: <webview>: Partially migrate loadcommit event from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 7 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ADVIEW_ADVIEW_GUEST_H_
6 #define CHROME_BROWSER_ADVIEW_ADVIEW_GUEST_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/observer_list.h"
10 #include "base/values.h"
11 #include "content/public/browser/web_contents_observer.h"
12
13 namespace chrome {
sky 2013/06/25 16:16:52 No need for a namespace here. But if you do want o
Fady Samuel 2013/06/25 16:54:42 Done.
14
15 // An AdViewGuest is a WebContentsObserver on the guest WebContents of a
16 // <adview> tag. It provides the browser-side implementation of the <adview>
17 // API and manages the lifetime of <adview> extension events. AdViewGuest is
18 // created on attachment. When a guest WebContents is associated with
19 // a particular embedder WebContents, we call this "attachment".
20 // TODO(fsamuel): There might be an opportunity here to refactor and reuse code
21 // between AdViewGuest and WebViewGuest.
22 class AdViewGuest : public content::WebContentsObserver {
23 public:
24 AdViewGuest(content::WebContents* guest_web_contents,
25 content::WebContents* embedder_web_contents,
26 const std::string& extension_id,
27 int adview_instance_id,
28 const base::DictionaryValue& args);
29
30 static AdViewGuest* From(int embedder_process_id, int instance_id);
31
32 content::WebContents* embedder_web_contents() const {
33 return embedder_web_contents_;
34 }
35
36 content::WebContents* web_contents() const {
37 return WebContentsObserver::web_contents();
38 }
39
40 int instance_id() const { return adview_instance_id_; }
sky 2013/06/25 16:16:52 style guide says accessor should method field name
Fady Samuel 2013/06/25 16:54:42 Renamed field and accessor to view_instance_id().
41
42 private:
43 virtual ~AdViewGuest();
44
45 void DispatchEvent(const std::string& event_name,
46 scoped_ptr<DictionaryValue> event);
47
48 virtual void DidCommitProvisionalLoadForFrame(
49 int64 frame_id,
50 bool is_main_frame,
51 const GURL& url,
52 content::PageTransition transition_type,
53 content::RenderViewHost* render_view_host) OVERRIDE;
54 virtual void WebContentsDestroyed(
55 content::WebContents* web_contents) OVERRIDE;
56
57 content::WebContents* embedder_web_contents_;
58 const std::string extension_id_;
59 const int embedder_render_process_id_;
60 // Profile and instance ID are cached here because |web_contents()| is
61 // null on destruction.
62 void* profile_;
63 // |guest_instance_id_| is a profile-wide unique identifier for a guest
64 // WebContents.
65 const int guest_instance_id_;
66 // |adview_instance_id_| is an identifier that's unique within a particular
67 // embedder RenderView for a particular <adview> instance.
68 const int adview_instance_id_;
69
70 DISALLOW_COPY_AND_ASSIGN(AdViewGuest);
71 };
72
73 } // namespace chrome
74
75 #endif // CHROME_BROWSER_ADVIEW_ADVIEW_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698