Rename CloseWebContents to RequestToClosePage
This commit is contained in:
parent
e41b0d4d2c
commit
62c44ee47b
4 changed files with 13 additions and 15 deletions
|
@ -315,7 +315,14 @@ void NativeWindow::CapturePage(const gfx::Rect& rect,
|
||||||
kBGRA_8888_SkColorType);
|
kBGRA_8888_SkColorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::CloseWebContents() {
|
content::WebContents* NativeWindow::GetWebContents() const {
|
||||||
|
if (inspectable_web_contents_)
|
||||||
|
return inspectable_web_contents_->GetWebContents();
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindow::RequestToClosePage() {
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver,
|
FOR_EACH_OBSERVER(NativeWindowObserver,
|
||||||
observers_,
|
observers_,
|
||||||
|
@ -344,13 +351,6 @@ void NativeWindow::CloseWebContents() {
|
||||||
web_contents->Close();
|
web_contents->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebContents* NativeWindow::GetWebContents() const {
|
|
||||||
if (inspectable_web_contents_)
|
|
||||||
return inspectable_web_contents_->GetWebContents();
|
|
||||||
else
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NativeWindow::AppendExtraCommandLineSwitches(
|
void NativeWindow::AppendExtraCommandLineSwitches(
|
||||||
base::CommandLine* command_line) {
|
base::CommandLine* command_line) {
|
||||||
// Append --node-integration to renderer process.
|
// Append --node-integration to renderer process.
|
||||||
|
|
|
@ -163,17 +163,15 @@ class NativeWindow : public content::WebContentsObserver,
|
||||||
virtual void SetMenuBarVisibility(bool visible);
|
virtual void SetMenuBarVisibility(bool visible);
|
||||||
virtual bool IsMenuBarVisible();
|
virtual bool IsMenuBarVisible();
|
||||||
|
|
||||||
// The same with closing a tab in a real browser.
|
|
||||||
//
|
|
||||||
// Should be called by platform code when user want to close the window.
|
|
||||||
virtual void CloseWebContents();
|
|
||||||
|
|
||||||
base::WeakPtr<NativeWindow> GetWeakPtr() {
|
base::WeakPtr<NativeWindow> GetWeakPtr() {
|
||||||
return weak_factory_.GetWeakPtr();
|
return weak_factory_.GetWeakPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebContents* GetWebContents() const;
|
content::WebContents* GetWebContents() const;
|
||||||
|
|
||||||
|
// Requests the WebContents to close, can be cancelled by the page.
|
||||||
|
virtual void RequestToClosePage();
|
||||||
|
|
||||||
// Methods called by the WebContents.
|
// Methods called by the WebContents.
|
||||||
virtual void CloseContents(content::WebContents* source);
|
virtual void CloseContents(content::WebContents* source);
|
||||||
virtual void RendererUnresponsive(content::WebContents* source);
|
virtual void RendererUnresponsive(content::WebContents* source);
|
||||||
|
|
|
@ -149,7 +149,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||||
// When user tries to close the window by clicking the close button, we do
|
// When user tries to close the window by clicking the close button, we do
|
||||||
// not close the window immediately, instead we try to close the web page
|
// not close the window immediately, instead we try to close the web page
|
||||||
// fisrt, and when the web page is closed the window will also be closed.
|
// fisrt, and when the web page is closed the window will also be closed.
|
||||||
shell_->CloseWebContents();
|
shell_->RequestToClosePage();
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ class NativeWindowClientView : public views::ClientView {
|
||||||
virtual ~NativeWindowClientView() {}
|
virtual ~NativeWindowClientView() {}
|
||||||
|
|
||||||
bool CanClose() override {
|
bool CanClose() override {
|
||||||
static_cast<NativeWindowViews*>(contents_view())->CloseWebContents();
|
static_cast<NativeWindowViews*>(contents_view())->RequestToClosePage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue