#elif defined(OS_WIN)
#include "atom/browser/ui/views/win_frame_view.h"
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
+#include "atom/browser/ui/win/thumbar_host.h"
#include "base/win/scoped_comptr.h"
#include "base/win/windows_version.h"
#include "ui/base/win/shell.h"
bool NativeWindowViews::SetThumbarButtons(
const std::vector<NativeWindow::ThumbarButton>& buttons) {
#if defined(OS_WIN)
- if (atom_desktop_window_tree_host_win_) {
- return atom_desktop_window_tree_host_win_->SetThumbarButtons(
- views::HWNDForNativeWindow(window_->GetNativeWindow()),
- buttons);
- }
-#endif
+ if (!thumbar_host_)
+ thumbar_host_.reset(new ThumbarHost(GetAcceleratedWidget()));
+ return thumbar_host_->SetThumbarButtons(buttons);
+#else
return false;
+#endif
}
gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() {
}
#endif
+#if defined(OS_WIN)
+bool NativeWindowViews::PreHandleMSG(
+ UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) {
+ // Handle thumbar button click message.
+ if (message == WM_COMMAND && HIWORD(w_param) == THBN_CLICKED &&
+ thumbar_host_)
+ return thumbar_host_->HandleThumbarButtonEvent(LOWORD(w_param));
+ else
+ return false;
+}
+#endif
+
void NativeWindowViews::HandleKeyboardEvent(
content::WebContents*,
const content::NativeWebKeyboardEvent& event) {
class GlobalMenuBarX11;
class MenuBar;
class WindowStateWatcher;
+
#if defined(OS_WIN)
class AtomDesktopWindowTreeHostWin;
+class ThumbarHost;
#endif
class NativeWindowViews : public NativeWindow,
std::string* name, std::string* class_name) override;
#endif
+#if defined(OS_WIN)
+ // MessageHandlerDelegate:
+ bool PreHandleMSG(
+ UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
+#endif
+
// NativeWindow:
void HandleKeyboardEvent(
content::WebContents*,
// Records window was whether restored from minimized state or maximized
// state.
bool is_minimized_;
+ // In charge of running thumbar related APIs.
+ scoped_ptr<ThumbarHost> thumbar_host_;
#endif
// Handles unhandled keyboard messages coming back from the renderer process.
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
-#include <shobjidl.h>
-
-#include "atom/browser/native_window.h"
-#include "atom/browser/ui/win/thumbar_host.h"
+#include "atom/browser/ui/win/message_handler_delegate.h"
namespace atom {
AtomDesktopWindowTreeHostWin::~AtomDesktopWindowTreeHostWin() {
}
-bool AtomDesktopWindowTreeHostWin::SetThumbarButtons(
- HWND window,
- const std::vector<NativeWindow::ThumbarButton>& buttons) {
- if (!thumbar_host_.get()) {
- thumbar_host_.reset(new ThumbarHost(window));
- }
- return thumbar_host_->SetThumbarButtons(buttons);
-}
-
-bool AtomDesktopWindowTreeHostWin::PreHandleMSG(UINT message,
- WPARAM w_param,
- LPARAM l_param,
- LRESULT* result) {
- switch (message) {
- case WM_COMMAND: {
- // Handle thumbar button click message.
- int id = LOWORD(w_param);
- int thbn_message = HIWORD(w_param);
- if (thbn_message == THBN_CLICKED && thumbar_host_ &&
- thumbar_host_->HandleThumbarButtonEvent(id))
- return true;
- }
- }
-
- return false;
+bool AtomDesktopWindowTreeHostWin::PreHandleMSG(
+ UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) {
+ return delegate_->PreHandleMSG(message, w_param, l_param, result);
}
} // namespace atom
#include <vector>
#include "atom/browser/native_window.h"
-#include "atom/browser/ui/win/thumbar_host.h"
-#include "base/memory/scoped_ptr.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
namespace atom {
views::DesktopNativeWidgetAura* desktop_native_widget_aura);
~AtomDesktopWindowTreeHostWin() override;
- bool SetThumbarButtons(
- HWND window,
- const std::vector<NativeWindow::ThumbarButton>& buttons);
-
protected:
bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
private:
MessageHandlerDelegate* delegate_; // weak ref
- scoped_ptr<ThumbarHost> thumbar_host_;
-
DISALLOW_COPY_AND_ASSIGN(AtomDesktopWindowTreeHostWin);
};