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

Side by Side Diff: chrome/browser/android/webapps/single_tab_mode_tab_helper.h

Issue 2821473002: Service CreateNewWindow on the UI thread with a new mojo interface (Closed)
Patch Set: dcheng fixes + security exploit browsertest nerfing Created 3 years, 8 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
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_ANDROID_WEBAPPS_SINGLE_TAB_MODE_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_SINGLE_TAB_MODE_TAB_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_WEBAPPS_SINGLE_TAB_MODE_TAB_HELPER_H_ 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_SINGLE_TAB_MODE_TAB_HELPER_H_
7 7
8 #include <stdint.h>
9
10 #include <set>
11
12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 8 #include "base/macros.h"
14 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" 9 #include "chrome/browser/ui/blocked_content/blocked_window_params.h"
15 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/browser/web_contents_user_data.h" 10 #include "content/public/browser/web_contents_user_data.h"
17 11
18 // Registers and unregisters the IDs of renderers in single tab mode, which 12 // Registers and unregisters the IDs of renderers in single tab mode, which
ncarter (slow) 2017/04/20 21:30:36 // Tracks tabs in single tab mode, which are disal
Charlie Harrison 2017/04/21 15:30:07 Done.
19 // are disallowed from opening new windows via 13 // are disallowed from opening new windows via
20 // ChromeContentBrowserClient::CanCreateWindow(). 14 // ChromeContentBrowserClient::CanCreateWindow().
21 class SingleTabModeTabHelper 15 class SingleTabModeTabHelper
22 : public content::WebContentsObserver, 16 : public content::WebContentsUserData<SingleTabModeTabHelper> {
23 public content::WebContentsUserData<SingleTabModeTabHelper> {
24 public: 17 public:
25 // Checks if the ID pair is blocked from creating new windows. IO-thread only. 18 ~SingleTabModeTabHelper() override;
26 static bool IsRegistered(int32_t process_id, int32_t routing_id);
27 19
28 ~SingleTabModeTabHelper() override; 20 bool block_all_new_windows() const { return block_all_new_windows_; }
29 21
30 // Handles opening the given URL through the TabModel. 22 // Handles opening the given URL through the TabModel.
31 void HandleOpenUrl(const BlockedWindowParams& params); 23 void HandleOpenUrl(const BlockedWindowParams& params);
32 24
33 // Permanently block this WebContents from creating new windows -- there is no 25 // Permanently block this WebContents from creating new windows -- there is no
34 // current need to allow toggling this flag on or off. 26 // current need to allow toggling this flag on or off.
35 void PermanentlyBlockAllNewWindows(); 27 void PermanentlyBlockAllNewWindows();
36 28
37 // content::WebContentsObserver
38 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
39 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
40
41 private: 29 private:
42 explicit SingleTabModeTabHelper(content::WebContents* web_contents); 30 explicit SingleTabModeTabHelper(content::WebContents* web_contents);
43 friend class content::WebContentsUserData<SingleTabModeTabHelper>; 31 friend class content::WebContentsUserData<SingleTabModeTabHelper>;
44 32
45 bool block_all_new_windows_; 33 content::WebContents* web_contents_;
ncarter (slow) 2017/04/20 21:30:35 #include web_contents.h
Charlie Harrison 2017/04/21 15:30:07 Only needs a fwd declaration, added one.
34 bool block_all_new_windows_ = false;
46 35
47 DISALLOW_COPY_AND_ASSIGN(SingleTabModeTabHelper); 36 DISALLOW_COPY_AND_ASSIGN(SingleTabModeTabHelper);
48 }; 37 };
49 38
50 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_SINGLE_TAB_MODE_TAB_HELPER_H_ 39 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_SINGLE_TAB_MODE_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698