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

Side by Side Diff: chrome/browser/background/background_contents.h

Issue 2877333004: UMA for measuring how often 2 or more tabs script the same background contents.
Patch Set: No PostDelayedTask and checking if opener is a hosted app Created 3 years, 7 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 | « no previous file | chrome/browser/background/background_contents.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BACKGROUND_BACKGROUND_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_H_
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_H_ 6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/site_instance.h" 17 #include "content/public/browser/site_instance.h"
18 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
19 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
20 #include "extensions/browser/deferred_start_render_host.h" 20 #include "extensions/browser/deferred_start_render_host.h"
21 #include "ui/base/window_open_disposition.h" 21 #include "ui/base/window_open_disposition.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 class Profile; 24 class Profile;
25 25
26 namespace content { 26 namespace content {
27 class RenderFrameHost;
27 class SessionStorageNamespace; 28 class SessionStorageNamespace;
28 }; 29 };
29 30
30 namespace extensions { 31 namespace extensions {
31 class ExtensionHostDelegate; 32 class ExtensionHostDelegate;
32 } 33 }
33 34
34 // This class maintains a WebContents used in the background. It can host a 35 // This class maintains a WebContents used in the background. It can host a
35 // renderer, but does not have any visible display. 36 // renderer, but does not have any visible display.
36 // TODO(atwilson): Unify this with background pages; http://crbug.com/77790 37 // TODO(atwilson): Unify this with background pages; http://crbug.com/77790
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 Profile* profile_; 116 Profile* profile_;
116 std::unique_ptr<content::WebContents> web_contents_; 117 std::unique_ptr<content::WebContents> web_contents_;
117 content::NotificationRegistrar registrar_; 118 content::NotificationRegistrar registrar_;
118 base::ObserverList<extensions::DeferredStartRenderHostObserver> 119 base::ObserverList<extensions::DeferredStartRenderHostObserver>
119 deferred_start_render_host_observer_list_; 120 deferred_start_render_host_observer_list_;
120 121
121 // The initial URL to load. 122 // The initial URL to load.
122 GURL initial_url_; 123 GURL initial_url_;
123 124
125 // TODO(lukasza): Remove members below after gathering sufficient UMA data for
126 // https://crbug.com/721947.
127 void DidChangeOpener() override;
128 void TrackPreviousOpener();
129 void OnPreviousOpenerDestroyed();
130 bool IsCurrentOpenerHostedApp();
131 content::RenderFrameHost* previous_opener_ = nullptr;
132 base::WeakPtrFactory<BackgroundContents> weak_factory_;
133
124 DISALLOW_COPY_AND_ASSIGN(BackgroundContents); 134 DISALLOW_COPY_AND_ASSIGN(BackgroundContents);
125 }; 135 };
126 136
127 // This is the data sent out as the details with BACKGROUND_CONTENTS_OPENED. 137 // This is the data sent out as the details with BACKGROUND_CONTENTS_OPENED.
128 struct BackgroundContentsOpenedDetails { 138 struct BackgroundContentsOpenedDetails {
129 // The BackgroundContents object that has just been opened. 139 // The BackgroundContents object that has just been opened.
130 BackgroundContents* contents; 140 BackgroundContents* contents;
131 141
132 // The name of the parent frame for these contents. 142 // The name of the parent frame for these contents.
133 const std::string& frame_name; 143 const std::string& frame_name;
134 144
135 // The ID of the parent application (if any). 145 // The ID of the parent application (if any).
136 const base::string16& application_id; 146 const base::string16& application_id;
137 }; 147 };
138 148
139 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_H_ 149 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/background/background_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698