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

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents_wrapper.h

Issue 10412061: Fix crashes in DownloadRequestLimiter when extension popups/bubbles initiate downloads automatically (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/property_bag.h" 13 #include "base/property_bag.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 15
16 class AlternateErrorPageTabObserver; 16 class AlternateErrorPageTabObserver;
17 class AutocompleteHistoryManager; 17 class AutocompleteHistoryManager;
18 class AutofillManager; 18 class AutofillManager;
19 class AutofillExternalDelegate; 19 class AutofillExternalDelegate;
20 class AutomationTabHelper; 20 class AutomationTabHelper;
21 class BlockedContentTabHelper; 21 class BlockedContentTabHelper;
22 class BookmarkTabHelper; 22 class BookmarkTabHelper;
23 class ConstrainedWindowTabHelper; 23 class ConstrainedWindowTabHelper;
24 class CoreTabHelper; 24 class CoreTabHelper;
25 class DownloadRequestLimiterObserver;
26 class ExtensionTabHelper; 25 class ExtensionTabHelper;
27 class ExternalProtocolObserver; 26 class ExternalProtocolObserver;
28 class FaviconTabHelper; 27 class FaviconTabHelper;
29 class FindTabHelper; 28 class FindTabHelper;
30 class HistoryTabHelper; 29 class HistoryTabHelper;
31 class HungPluginTabHelper; 30 class HungPluginTabHelper;
32 class InfoBarTabHelper; 31 class InfoBarTabHelper;
33 class OmniboxSearchHint; 32 class OmniboxSearchHint;
34 class PasswordManager; 33 class PasswordManager;
35 class PasswordManagerDelegate; 34 class PasswordManagerDelegate;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 class PrintPreviewMessageHandler; 67 class PrintPreviewMessageHandler;
69 } 68 }
70 69
71 namespace safe_browsing { 70 namespace safe_browsing {
72 class SafeBrowsingTabObserver; 71 class SafeBrowsingTabObserver;
73 } 72 }
74 73
75 // Wraps WebContents and all of its supporting objects in order to control 74 // Wraps WebContents and all of its supporting objects in order to control
76 // their ownership and lifetime. 75 // their ownership and lifetime.
77 // 76 //
77 // WARNING: Not every place where HTML can run has a TabContentsWrapper. This
78 // class is *only* used in a visible, actual, tab inside a browser. Examples of
79 // things that do not have tab wrappers include:
80 // - Extension background pages and popup bubbles
81 // - HTML notification bubbles
82 // - Screensavers on Chrome OS
83 // - Other random places we decide to display HTML over time
84 //
85 // Consider carefully whether your feature is something that makes sense only
86 // when a tab is displayed, or could make sense in other cases we use HTML. It
87 // may makes sense to push down into WebContents and make configurable, or at
88 // least to make easy for other WebContents hosts to include and support.
89 //
78 // TODO(avi): Eventually, this class will become TabContents as far as 90 // TODO(avi): Eventually, this class will become TabContents as far as
79 // the browser front-end is concerned. 91 // the browser front-end is concerned.
80 class TabContentsWrapper : public content::WebContentsObserver { 92 class TabContentsWrapper : public content::WebContentsObserver {
81 public: 93 public:
82 // Takes ownership of |contents|, which must be heap-allocated (as it lives 94 // Takes ownership of |contents|, which must be heap-allocated (as it lives
83 // in a scoped_ptr) and can not be NULL. 95 // in a scoped_ptr) and can not be NULL.
84 explicit TabContentsWrapper(content::WebContents* contents); 96 explicit TabContentsWrapper(content::WebContents* contents);
85 virtual ~TabContentsWrapper(); 97 virtual ~TabContentsWrapper();
86 98
87 // Create a TabContentsWrapper with the same state as this one. The returned 99 // Create a TabContentsWrapper with the same state as this one. The returned
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 scoped_ptr<TranslateTabHelper> translate_tab_helper_; 276 scoped_ptr<TranslateTabHelper> translate_tab_helper_;
265 277
266 // Handles displaying a web intents picker to the user. 278 // Handles displaying a web intents picker to the user.
267 scoped_ptr<WebIntentPickerController> web_intent_picker_controller_; 279 scoped_ptr<WebIntentPickerController> web_intent_picker_controller_;
268 280
269 // Per-tab observers --------------------------------------------------------- 281 // Per-tab observers ---------------------------------------------------------
270 // (These provide no API for callers; objects that need to exist 1:1 with tabs 282 // (These provide no API for callers; objects that need to exist 1:1 with tabs
271 // and silently do their thing live here.) 283 // and silently do their thing live here.)
272 284
273 scoped_ptr<AlternateErrorPageTabObserver> alternate_error_page_tab_observer_; 285 scoped_ptr<AlternateErrorPageTabObserver> alternate_error_page_tab_observer_;
274 scoped_ptr<DownloadRequestLimiterObserver> download_request_limiter_observer_;
275 scoped_ptr<extensions::WebNavigationTabObserver> webnavigation_observer_; 286 scoped_ptr<extensions::WebNavigationTabObserver> webnavigation_observer_;
276 scoped_ptr<ExternalProtocolObserver> external_protocol_observer_; 287 scoped_ptr<ExternalProtocolObserver> external_protocol_observer_;
277 scoped_ptr<OmniboxSearchHint> omnibox_search_hint_; 288 scoped_ptr<OmniboxSearchHint> omnibox_search_hint_;
278 #if defined(ENABLE_ONE_CLICK_SIGNIN) 289 #if defined(ENABLE_ONE_CLICK_SIGNIN)
279 scoped_ptr<OneClickSigninHelper> one_click_signin_helper_; 290 scoped_ptr<OneClickSigninHelper> one_click_signin_helper_;
280 #endif 291 #endif
281 scoped_ptr<PDFTabObserver> pdf_tab_observer_; 292 scoped_ptr<PDFTabObserver> pdf_tab_observer_;
282 scoped_ptr<PluginObserver> plugin_observer_; 293 scoped_ptr<PluginObserver> plugin_observer_;
283 scoped_ptr<printing::PrintPreviewMessageHandler> print_preview_; 294 scoped_ptr<printing::PrintPreviewMessageHandler> print_preview_;
284 scoped_ptr<safe_browsing::SafeBrowsingTabObserver> 295 scoped_ptr<safe_browsing::SafeBrowsingTabObserver>
285 safe_browsing_tab_observer_; 296 safe_browsing_tab_observer_;
286 297
287 // WebContents (MUST BE LAST) ------------------------------------------------ 298 // WebContents (MUST BE LAST) ------------------------------------------------
288 299
289 // If true, we're running the destructor. 300 // If true, we're running the destructor.
290 bool in_destructor_; 301 bool in_destructor_;
291 302
292 // The supporting objects need to outlive the WebContents dtor (as they may 303 // The supporting objects need to outlive the WebContents dtor (as they may
293 // be called upon during its execution). As a result, this must come last 304 // be called upon during its execution). As a result, this must come last
294 // in the list. 305 // in the list.
295 scoped_ptr<content::WebContents> web_contents_; 306 scoped_ptr<content::WebContents> web_contents_;
296 307
297 DISALLOW_COPY_AND_ASSIGN(TabContentsWrapper); 308 DISALLOW_COPY_AND_ASSIGN(TabContentsWrapper);
298 }; 309 };
299 310
300 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ 311 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter_unittest.cc ('k') | chrome/browser/ui/tab_contents/tab_contents_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698