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

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, 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 | « chrome/browser/adview/adview_constants.cc ('k') | chrome/browser/adview/adview_guest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // An AdViewGuest is a WebContentsObserver on the guest WebContents of a
14 // <adview> tag. It provides the browser-side implementation of the <adview>
15 // API and manages the lifetime of <adview> extension events. AdViewGuest is
16 // created on attachment. When a guest WebContents is associated with
17 // a particular embedder WebContents, we call this "attachment".
18 // TODO(fsamuel): There might be an opportunity here to refactor and reuse code
19 // between AdViewGuest and WebViewGuest.
20 class AdViewGuest : public content::WebContentsObserver {
21 public:
22 AdViewGuest(content::WebContents* guest_web_contents,
23 content::WebContents* embedder_web_contents,
24 const std::string& extension_id,
25 int adview_instance_id,
26 const base::DictionaryValue& args);
27
28 static AdViewGuest* From(int embedder_process_id, int instance_id);
29
30 content::WebContents* embedder_web_contents() const {
31 return embedder_web_contents_;
32 }
33
34 content::WebContents* web_contents() const {
35 return WebContentsObserver::web_contents();
36 }
37
38 int view_instance_id() const { return view_instance_id_; }
39
40 private:
41 virtual ~AdViewGuest();
42
43 void DispatchEvent(const std::string& event_name,
44 scoped_ptr<DictionaryValue> event);
45
46 virtual void DidCommitProvisionalLoadForFrame(
47 int64 frame_id,
48 bool is_main_frame,
49 const GURL& url,
50 content::PageTransition transition_type,
51 content::RenderViewHost* render_view_host) OVERRIDE;
52 virtual void WebContentsDestroyed(
53 content::WebContents* web_contents) OVERRIDE;
54
55 content::WebContents* embedder_web_contents_;
56 const std::string extension_id_;
57 const int embedder_render_process_id_;
58 // Profile and instance ID are cached here because |web_contents()| is
59 // null on destruction.
60 void* profile_;
61 // |guest_instance_id_| is a profile-wide unique identifier for a guest
62 // WebContents.
63 const int guest_instance_id_;
64 // |view_instance_id_| is an identifier that's unique within a particular
65 // embedder RenderView for a particular <adview> instance.
66 const int view_instance_id_;
67
68 DISALLOW_COPY_AND_ASSIGN(AdViewGuest);
69 };
70
71 #endif // CHROME_BROWSER_ADVIEW_ADVIEW_GUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/adview/adview_constants.cc ('k') | chrome/browser/adview/adview_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698