summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-22 11:27:26 +0000
committerdpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-22 11:27:26 +0000
commit9a80e223543e0367df0ed5c35fe0381a5afa0500 (patch)
treeed52b5352ad999e2855f07537b0415741fe02a82 /chrome
parent4e355312a3e17315bf02ac81d21cfba45dc2830a (diff)
downloadchromium_src-9a80e223543e0367df0ed5c35fe0381a5afa0500.zip
chromium_src-9a80e223543e0367df0ed5c35fe0381a5afa0500.tar.gz
chromium_src-9a80e223543e0367df0ed5c35fe0381a5afa0500.tar.bz2
Turn off context menu for file browser dialogs.
BUG=http://code.google.com/p/chromium-os/issues/detail?id=8793 TEST=manual Review URL: http://codereview.chromium.org/4895001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dom_ui/html_dialog_ui.cc4
-rw-r--r--chrome/browser/dom_ui/html_dialog_ui.h6
-rw-r--r--chrome/browser/ui/views/html_dialog_view.cc21
-rw-r--r--chrome/browser/ui/views/html_dialog_view.h1
-rw-r--r--chrome/browser/ui/views/select_file_dialog.cc3
5 files changed, 25 insertions, 10 deletions
diff --git a/chrome/browser/dom_ui/html_dialog_ui.cc b/chrome/browser/dom_ui/html_dialog_ui.cc
index ff49805..ee9ce34 100644
--- a/chrome/browser/dom_ui/html_dialog_ui.cc
+++ b/chrome/browser/dom_ui/html_dialog_ui.cc
@@ -79,3 +79,7 @@ ExternalHtmlDialogUI::ExternalHtmlDialogUI(TabContents* tab_contents)
ExternalHtmlDialogUI::~ExternalHtmlDialogUI() {
}
+
+bool HtmlDialogUIDelegate::HandleContextMenu(const ContextMenuParams& params) {
+ return false;
+}
diff --git a/chrome/browser/dom_ui/html_dialog_ui.h b/chrome/browser/dom_ui/html_dialog_ui.h
index d1cc849..5cd9eed 100644
--- a/chrome/browser/dom_ui/html_dialog_ui.h
+++ b/chrome/browser/dom_ui/html_dialog_ui.h
@@ -17,6 +17,8 @@ namespace gfx {
class Size;
}
+struct ContextMenuParams;
+
// Implement this class to receive notifications.
class HtmlDialogUIDelegate {
public:
@@ -55,6 +57,10 @@ class HtmlDialogUIDelegate {
// have a title bar. This is useful when presenting branded interfaces.
virtual bool ShouldShowDialogTitle() const = 0;
+ // A callback to allow the delegate to inhibit context menu or show
+ // customized menu.
+ virtual bool HandleContextMenu(const ContextMenuParams& params);
+
protected:
virtual ~HtmlDialogUIDelegate() {}
};
diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc
index 96db478..2cb5cb0 100644
--- a/chrome/browser/ui/views/html_dialog_view.cc
+++ b/chrome/browser/ui/views/html_dialog_view.cc
@@ -71,15 +71,13 @@ bool HtmlDialogView::CanResize() const {
bool HtmlDialogView::IsModal() const {
if (delegate_)
return delegate_->IsDialogModal();
- else
- return false;
+ return false;
}
std::wstring HtmlDialogView::GetWindowTitle() const {
if (delegate_)
return delegate_->GetDialogTitle();
- else
- return std::wstring();
+ return std::wstring();
}
void HtmlDialogView::WindowClosing() {
@@ -116,8 +114,7 @@ std::wstring HtmlDialogView::GetDialogTitle() const {
GURL HtmlDialogView::GetDialogContentURL() const {
if (delegate_)
return delegate_->GetDialogContentURL();
- else
- return GURL();
+ return GURL();
}
void HtmlDialogView::GetDOMMessageHandlers(
@@ -134,8 +131,7 @@ void HtmlDialogView::GetDialogSize(gfx::Size* size) const {
std::string HtmlDialogView::GetDialogArgs() const {
if (delegate_)
return delegate_->GetDialogArgs();
- else
- return std::string();
+ return std::string();
}
void HtmlDialogView::OnDialogClosed(const std::string& json_retval) {
@@ -157,8 +153,13 @@ void HtmlDialogView::OnCloseContents(TabContents* source,
bool HtmlDialogView::ShouldShowDialogTitle() const {
if (delegate_)
return delegate_->ShouldShowDialogTitle();
- else
- return true;
+ return true;
+}
+
+bool HtmlDialogView::HandleContextMenu(const ContextMenuParams& params) {
+ if (delegate_)
+ return delegate_->HandleContextMenu(params);
+ return HtmlDialogTabContentsDelegate::HandleContextMenu(params);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/views/html_dialog_view.h b/chrome/browser/ui/views/html_dialog_view.h
index 5a51832..5706c68 100644
--- a/chrome/browser/ui/views/html_dialog_view.h
+++ b/chrome/browser/ui/views/html_dialog_view.h
@@ -68,6 +68,7 @@ class HtmlDialogView
virtual void OnDialogClosed(const std::string& json_retval);
virtual void OnCloseContents(TabContents* source, bool* out_close_dialog);
virtual bool ShouldShowDialogTitle() const;
+ virtual bool HandleContextMenu(const ContextMenuParams& params);
// Overridden from TabContentsDelegate:
virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
diff --git a/chrome/browser/ui/views/select_file_dialog.cc b/chrome/browser/ui/views/select_file_dialog.cc
index abe8f88..702d546 100644
--- a/chrome/browser/ui/views/select_file_dialog.cc
+++ b/chrome/browser/ui/views/select_file_dialog.cc
@@ -116,6 +116,9 @@ class SelectFileDialogImpl : public SelectFileDialog {
virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) {
}
virtual bool ShouldShowDialogTitle() const { return true; }
+ virtual bool HandleContextMenu(const ContextMenuParams& params) {
+ return true;
+ }
DISALLOW_COPY_AND_ASSIGN(FileBrowseDelegate);
};