summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/shell_dialogs.h20
-rw-r--r--chrome/browser/tab_contents/web_contents.cc5
-rw-r--r--chrome/browser/tab_contents/web_contents_view.h4
-rw-r--r--chrome/browser/tab_contents/web_contents_view_win.cc4
-rw-r--r--chrome/browser/tab_contents/web_contents_view_win.h1
-rw-r--r--chrome/browser/views/SConscript6
-rw-r--r--chrome/browser/views/browser_views.vcproj2
-rw-r--r--chrome/browser/views/shell_dialogs_win.cc (renamed from chrome/browser/views/shell_dialogs.cc)0
8 files changed, 24 insertions, 18 deletions
diff --git a/chrome/browser/shell_dialogs.h b/chrome/browser/shell_dialogs.h
index a0edff1..de81210 100644
--- a/chrome/browser/shell_dialogs.h
+++ b/chrome/browser/shell_dialogs.h
@@ -5,12 +5,10 @@
#ifndef CHROME_BROWSER_SHELL_DIALOGS_H_
#define CHROME_BROWSER_SHELL_DIALOGS_H_
-// TODO(maruel): Remove once HWND is typedef.
-#include <windows.h>
-
#include <string>
#include <vector>
+#include "base/gfx/native_widget_types.h"
#include "base/ref_counted.h"
class ChromeFont;
@@ -23,7 +21,7 @@ class BaseShellDialog {
public:
// Returns true if the a shell dialog box is currently being shown modally
// to the specified owner.
- virtual bool IsRunning(HWND owning_hwnd) const = 0;
+ virtual bool IsRunning(gfx::NativeView owning_window) const = 0;
// Notifies the dialog box that the listener has been destroyed and it should
// no longer be sent notifications.
@@ -96,7 +94,7 @@ class SelectFileDialog
const std::wstring& default_path,
const std::wstring& filter,
const std::wstring& default_extension,
- HWND owning_hwnd,
+ gfx::NativeView owning_window,
void* params) = 0;
};
@@ -128,26 +126,26 @@ class SelectFontDialog
static SelectFontDialog* Create(Listener* listener);
// Selects a font. This will start displaying the dialog box. This will also
- // block the calling HWND until the dialog box is complete. The listener
+ // block the calling window until the dialog box is complete. The listener
// associated with this object will be notified when the selection is
// complete.
- // |owning_hwnd| is the window the dialog is modal to, or NULL for a modeless
- // dialog.
+ // |owning_window| is the window the dialog is modal to, or NULL for a
+ // modeless dialog.
// |params| is data from the calling context which will be passed through to
// the listener. Can be NULL.
// NOTE: only one instance of any shell dialog can be shown per owning_hwnd
// at a time (for obvious reasons).
// TODO(beng): support specifying the default font selected in the list when
// the dialog appears.
- virtual void SelectFont(HWND owning_hwnd,
+ virtual void SelectFont(gfx::NativeView owning_window,
void* params) = 0;
// Same as above - also support specifying the default font selected in the
// list when the dialog appears.
- virtual void SelectFont(HWND owning_hwnd,
+ virtual void SelectFont(gfx::NativeView owning_window,
void* params,
const std::wstring& font_name,
int font_size) = 0;
};
-#endif // #ifndef CHROME_BROWSER_SHELL_DIALOGS_H_
+#endif // CHROME_BROWSER_SHELL_DIALOGS_H_
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index 63e6689..8cc690f 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -990,15 +990,14 @@ void WebContents::RunFileChooser(bool multiple_files,
const std::wstring& title,
const std::wstring& default_file,
const std::wstring& filter) {
- // TODO(brettw) move this to the view.
- HWND toplevel_hwnd = GetAncestor(GetContainerHWND(), GA_ROOT);
if (!select_file_dialog_.get())
select_file_dialog_ = SelectFileDialog::Create(this);
SelectFileDialog::Type dialog_type =
multiple_files ? SelectFileDialog::SELECT_OPEN_MULTI_FILE :
SelectFileDialog::SELECT_OPEN_FILE;
select_file_dialog_->SelectFile(dialog_type, title, default_file, filter,
- std::wstring(), toplevel_hwnd, NULL);
+ std::wstring(),
+ view_->GetTopLevelNativeView(), NULL);
}
void WebContents::RunJavaScriptMessage(
diff --git a/chrome/browser/tab_contents/web_contents_view.h b/chrome/browser/tab_contents/web_contents_view.h
index ab7ae97..1db1a52 100644
--- a/chrome/browser/tab_contents/web_contents_view.h
+++ b/chrome/browser/tab_contents/web_contents_view.h
@@ -57,6 +57,10 @@ class WebContentsView : public RenderViewHostDelegate::View {
// the container).
virtual gfx::NativeView GetContentNativeView() const = 0;
+ // Returns the outermost native view. This will be used as the parent for
+ // dialog boxes.
+ virtual gfx::NativeView GetTopLevelNativeView() const = 0;
+
// Computes the rectangle for the native widget that contains the contents of
// the tab relative to its parent.
virtual void GetContainerBounds(gfx::Rect *out) const = 0;
diff --git a/chrome/browser/tab_contents/web_contents_view_win.cc b/chrome/browser/tab_contents/web_contents_view_win.cc
index f2cee8b..f294d6a 100644
--- a/chrome/browser/tab_contents/web_contents_view_win.cc
+++ b/chrome/browser/tab_contents/web_contents_view_win.cc
@@ -84,6 +84,10 @@ gfx::NativeView WebContentsViewWin::GetContentNativeView() const {
return web_contents_->render_widget_host_view()->GetPluginNativeView();
}
+gfx::NativeView WebContentsViewWin::GetTopLevelNativeView() const {
+ return ::GetAncestor(GetNativeView(), GA_ROOT);
+}
+
void WebContentsViewWin::GetContainerBounds(gfx::Rect* out) const {
GetBounds(out, false);
}
diff --git a/chrome/browser/tab_contents/web_contents_view_win.h b/chrome/browser/tab_contents/web_contents_view_win.h
index 2658fb6..d891614 100644
--- a/chrome/browser/tab_contents/web_contents_view_win.h
+++ b/chrome/browser/tab_contents/web_contents_view_win.h
@@ -34,6 +34,7 @@ class WebContentsViewWin : public WebContentsView,
RenderWidgetHost* render_widget_host);
virtual gfx::NativeView GetNativeView() const;
virtual gfx::NativeView GetContentNativeView() const;
+ virtual gfx::NativeView GetTopLevelNativeView() const;
virtual void GetContainerBounds(gfx::Rect* out) const;
virtual void OnContentsDestroy();
virtual void SetPageTitle(const std::wstring& title);
diff --git a/chrome/browser/views/SConscript b/chrome/browser/views/SConscript
index a12a43f..55f599f 100644
--- a/chrome/browser/views/SConscript
+++ b/chrome/browser/views/SConscript
@@ -209,7 +209,7 @@ input_files = ChromeFileList([
'select_profile_dialog.h',
'shelf_item_dialog.cc',
'shelf_item_dialog.h',
- 'shell_dialogs.cc',
+ 'shell_dialogs_win.cc',
'standard_layout.h',
'star_toggle.cc',
'star_toggle.h',
@@ -293,7 +293,7 @@ if env.Bit('linux'):
'restart_message_box.cc',
'select_profile_dialog.cc',
'shelf_item_dialog.cc',
- 'shell_dialogs.cc',
+ 'shell_dialogs_win.cc',
'star_toggle.cc',
'status_bubble.cc',
'tab_contents_container_view.cc',
@@ -376,7 +376,7 @@ if env.Bit('mac'):
'sad_tab_view.cc',
'select_profile_dialog.cc',
'shelf_item_dialog.cc',
- 'shell_dialogs.cc',
+ 'shell_dialogs_win.cc',
'star_toggle.cc',
'status_bubble.cc',
'tab_contents_container_view.cc',
diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj
index 825d0cc..3a85578 100644
--- a/chrome/browser/views/browser_views.vcproj
+++ b/chrome/browser/views/browser_views.vcproj
@@ -730,7 +730,7 @@
>
</File>
<File
- RelativePath=".\shell_dialogs.cc"
+ RelativePath=".\shell_dialogs_win.cc"
>
</File>
<File
diff --git a/chrome/browser/views/shell_dialogs.cc b/chrome/browser/views/shell_dialogs_win.cc
index be3da01..be3da01 100644
--- a/chrome/browser/views/shell_dialogs.cc
+++ b/chrome/browser/views/shell_dialogs_win.cc