Commit aeef8749 authored by Charles Harrison's avatar Charles Harrison Committed by Commit Bot

Refactor: remove bool* was_blocked from chrome::AddWebContents

This CL should not change behavior. We could probably remove the param
from WebContentsDelegate::AddWebContents but some delegates actually
set it, so the change would be more complicated and could change
behavior.

Bug: None
Change-Id: I2b25c7ae4fb86c2aad386697832bb5017ea7744f
Reviewed-on: https://chromium-review.googlesource.com/655126Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501385}
parent 67e58ded
...@@ -867,6 +867,6 @@ void BackgroundContentsService::AddWebContents( ...@@ -867,6 +867,6 @@ void BackgroundContentsService::AddWebContents(
Profile::FromBrowserContext(new_contents->GetBrowserContext())); Profile::FromBrowserContext(new_contents->GetBrowserContext()));
if (browser) { if (browser) {
chrome::AddWebContents(browser, NULL, new_contents, disposition, chrome::AddWebContents(browser, NULL, new_contents, disposition,
initial_rect, user_gesture, was_blocked); initial_rect, user_gesture);
} }
} }
...@@ -70,12 +70,8 @@ void CustomLauncherPageContents::AddNewContents( ...@@ -70,12 +70,8 @@ void CustomLauncherPageContents::AddNewContents(
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture,
bool* was_blocked) { bool* was_blocked) {
app_delegate_->AddNewContents(new_contents->GetBrowserContext(), app_delegate_->AddNewContents(new_contents->GetBrowserContext(), new_contents,
new_contents, disposition, initial_rect, user_gesture);
disposition,
initial_rect,
user_gesture,
was_blocked);
} }
bool CustomLauncherPageContents::IsPopupOrPanel( bool CustomLauncherPageContents::IsPopupOrPanel(
......
...@@ -169,7 +169,7 @@ class StartPageService::StartPageWebContentsDelegate ...@@ -169,7 +169,7 @@ class StartPageService::StartPageWebContentsDelegate
? disposition ? disposition
: WindowOpenDisposition::NEW_FOREGROUND_TAB; : WindowOpenDisposition::NEW_FOREGROUND_TAB;
chrome::AddWebContents(displayer.browser(), nullptr, new_contents, chrome::AddWebContents(displayer.browser(), nullptr, new_contents,
disposition, initial_pos, user_gesture, was_blocked); disposition, initial_pos, user_gesture);
} }
content::WebContents* OpenURLFromTab( content::WebContents* OpenURLFromTab(
......
...@@ -233,8 +233,7 @@ void ChromeAppDelegate::AddNewContents(content::BrowserContext* context, ...@@ -233,8 +233,7 @@ void ChromeAppDelegate::AddNewContents(content::BrowserContext* context,
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture) {
bool* was_blocked) {
if (!disable_external_open_for_testing_) { if (!disable_external_open_for_testing_) {
// We don't really want to open a window for |new_contents|, but we need to // We don't really want to open a window for |new_contents|, but we need to
// capture its intended navigation. Here we give ownership to the // capture its intended navigation. Here we give ownership to the
...@@ -250,13 +249,8 @@ void ChromeAppDelegate::AddNewContents(content::BrowserContext* context, ...@@ -250,13 +249,8 @@ void ChromeAppDelegate::AddNewContents(content::BrowserContext* context,
disposition = disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB disposition = disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB
? disposition ? disposition
: WindowOpenDisposition::NEW_FOREGROUND_TAB; : WindowOpenDisposition::NEW_FOREGROUND_TAB;
chrome::AddWebContents(displayer.browser(), chrome::AddWebContents(displayer.browser(), NULL, new_contents, disposition,
NULL, initial_rect, user_gesture);
new_contents,
disposition,
initial_rect,
user_gesture,
was_blocked);
} }
content::ColorChooser* ChromeAppDelegate::ShowColorChooser( content::ColorChooser* ChromeAppDelegate::ShowColorChooser(
......
...@@ -51,8 +51,7 @@ class ChromeAppDelegate : public extensions::AppDelegate, ...@@ -51,8 +51,7 @@ class ChromeAppDelegate : public extensions::AppDelegate,
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture) override;
bool* was_blocked) override;
content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
SkColor initial_color) override; SkColor initial_color) override;
void RunFileChooser(content::RenderFrameHost* render_frame_host, void RunFileChooser(content::RenderFrameHost* render_frame_host,
......
...@@ -1556,7 +1556,7 @@ void Browser::AddNewContents(WebContents* source, ...@@ -1556,7 +1556,7 @@ void Browser::AddNewContents(WebContents* source,
if (PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition)) if (PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition))
PopupTracker::CreateForWebContents(new_contents); PopupTracker::CreateForWebContents(new_contents);
chrome::AddWebContents(this, source, new_contents, disposition, initial_rect, chrome::AddWebContents(this, source, new_contents, disposition, initial_rect,
user_gesture, was_blocked); user_gesture);
} }
void Browser::ActivateContents(WebContents* contents) { void Browser::ActivateContents(WebContents* contents) {
......
...@@ -51,8 +51,7 @@ void AddWebContents(Browser* browser, ...@@ -51,8 +51,7 @@ void AddWebContents(Browser* browser,
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture) {
bool* was_blocked) {
// No code for this yet. // No code for this yet.
DCHECK(disposition != WindowOpenDisposition::SAVE_TO_DISK); DCHECK(disposition != WindowOpenDisposition::SAVE_TO_DISK);
// Can't create a new contents for the current tab - invalid case. // Can't create a new contents for the current tab - invalid case.
......
...@@ -33,16 +33,13 @@ content::WebContents* AddSelectedTabWithURL(Browser* browser, ...@@ -33,16 +33,13 @@ content::WebContents* AddSelectedTabWithURL(Browser* browser,
// Creates a new tab with the already-created WebContents 'new_contents'. // Creates a new tab with the already-created WebContents 'new_contents'.
// The window for the added contents will be reparented correctly when this // The window for the added contents will be reparented correctly when this
// method returns. If |disposition| is NEW_POPUP, |initial_rect| should hold // method returns. If |disposition| is NEW_POPUP, |initial_rect| should hold
// the initial position and size. If |was_blocked| is non-NULL, then // the initial position and size.
// |*was_blocked| will be set to true if the popup gets blocked, and left
// unchanged otherwise.
void AddWebContents(Browser* browser, void AddWebContents(Browser* browser,
content::WebContents* source_contents, content::WebContents* source_contents,
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture);
bool* was__blocked);
// Closes the specified WebContents in the specified Browser. If // Closes the specified WebContents in the specified Browser. If
// |add_to_history| is true, an entry in the historical tab database is created. // |add_to_history| is true, an entry in the historical tab database is created.
......
...@@ -97,10 +97,9 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) { ...@@ -97,10 +97,9 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) {
std::unique_ptr<content::WebContents> web_contents( std::unique_ptr<content::WebContents> web_contents(
content::WebContents::Create( content::WebContents::Create(
content::WebContents::CreateParams(browser()->profile()))); content::WebContents::CreateParams(browser()->profile())));
bool was_blocked = false;
chrome::AddWebContents(browser(), NULL, web_contents.release(), chrome::AddWebContents(browser(), NULL, web_contents.release(),
WindowOpenDisposition::NEW_BACKGROUND_TAB, gfx::Rect(), WindowOpenDisposition::NEW_BACKGROUND_TAB, gfx::Rect(),
false, &was_blocked); false);
content::WebContents* tab2 = content::WebContents* tab2 =
browser()->tab_strip_model()->GetWebContentsAt(2); browser()->tab_strip_model()->GetWebContentsAt(2);
ASSERT_TRUE(tab2); ASSERT_TRUE(tab2);
......
...@@ -52,8 +52,7 @@ class AppDelegate { ...@@ -52,8 +52,7 @@ class AppDelegate {
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture) = 0;
bool* was_blocked) = 0;
// Feature support. // Feature support.
virtual content::ColorChooser* ShowColorChooser( virtual content::ColorChooser* ShowColorChooser(
......
...@@ -372,12 +372,8 @@ void AppWindow::AddNewContents(WebContents* source, ...@@ -372,12 +372,8 @@ void AppWindow::AddNewContents(WebContents* source,
bool user_gesture, bool user_gesture,
bool* was_blocked) { bool* was_blocked) {
DCHECK(new_contents->GetBrowserContext() == browser_context_); DCHECK(new_contents->GetBrowserContext() == browser_context_);
app_delegate_->AddNewContents(browser_context_, app_delegate_->AddNewContents(browser_context_, new_contents, disposition,
new_contents, initial_rect, user_gesture);
disposition,
initial_rect,
user_gesture,
was_blocked);
} }
content::KeyboardEventProcessingResult AppWindow::PreHandleKeyboardEvent( content::KeyboardEventProcessingResult AppWindow::PreHandleKeyboardEvent(
......
...@@ -45,8 +45,7 @@ void ShellAppDelegate::AddNewContents(content::BrowserContext* context, ...@@ -45,8 +45,7 @@ void ShellAppDelegate::AddNewContents(content::BrowserContext* context,
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture) {
bool* was_blocked) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
......
...@@ -31,8 +31,7 @@ class ShellAppDelegate : public AppDelegate { ...@@ -31,8 +31,7 @@ class ShellAppDelegate : public AppDelegate {
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
const gfx::Rect& initial_rect, const gfx::Rect& initial_rect,
bool user_gesture, bool user_gesture) override;
bool* was_blocked) override;
content::ColorChooser* ShowColorChooser(content::WebContents* web_contents, content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
SkColor initial_color) override; SkColor initial_color) override;
void RunFileChooser(content::RenderFrameHost* render_frame_host, void RunFileChooser(content::RenderFrameHost* render_frame_host,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment