Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge client_handler_win.cpp into client_handler.cpp and disable righ…

…t click popups.
  • Loading branch information...
commit 152e4347d051780e80ae1feaf931bde2094da75f 1 parent dc95476
= authored
View
1  cefclient.vcxproj
@@ -312,7 +312,6 @@
<ClCompile Include="cefclient\cefclient_win.cpp" />
<ClCompile Include="cefclient\client_handler.cpp" />
<ClCompile Include="cefclient\client_popup_handler.cpp" />
- <ClCompile Include="cefclient\client_handler_win.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="cefclient\cefclient.rc" />
View
3  cefclient.vcxproj.filters
@@ -127,9 +127,6 @@
<ClInclude Include="cefclient\util.h">
<Filter>cefclient</Filter>
</ClInclude>
- <ClCompile Include="cefclient\client_handler_win.cpp">
- <Filter>cefclient</Filter>
- </ClCompile>
<None Include="cefclient\res\extensionperf.html">
<Filter>cefclient\res</Filter>
</None>
View
49 cefclient/client_handler.cpp
@@ -203,3 +203,52 @@ std::string ClientHandler::GetLastDownloadFile()
AutoLock lock_scope(this);
return m_LastDownloadFile;
}
+
+bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
+ const CefPopupFeatures& popupFeatures,
+ CefWindowInfo& windowInfo,
+ const CefString& url,
+ CefRefPtr<CefClient>& client,
+ CefBrowserSettings& settings)
+{
+ REQUIRE_UI_THREAD();
+ std::string urlStr = url;
+ if(urlStr.find("chrome-devtools:") == std::string::npos) {
+ // Show all popup windows excluding DevTools in the current window.
+ windowInfo.m_dwStyle &= ~WS_VISIBLE;
+ client = new ClientPopupHandler(m_Browser);
+ }
+ return false;
+}
+
+// Disables right-click menus.
+bool ClientHandler::OnBeforeMenu(CefRefPtr<CefBrowser> browser,
+ const CefMenuInfo& menuInfo)
+{
+ return true;
+}
+
+void ClientHandler::SendNotification(NotificationType type)
+{
+ UINT id;
+ switch(type)
+ {
+ case NOTIFY_CONSOLE_MESSAGE:
+ id = ID_WARN_CONSOLEMESSAGE;
+ break;
+ case NOTIFY_DOWNLOAD_COMPLETE:
+ id = ID_WARN_DOWNLOADCOMPLETE;
+ break;
+ case NOTIFY_DOWNLOAD_ERROR:
+ id = ID_WARN_DOWNLOADERROR;
+ break;
+ default:
+ return;
+ }
+ PostMessage(m_MainHwnd, WM_COMMAND, id, 0);
+}
+
+void ClientHandler::CloseMainWindow()
+{
+ ::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0);
+}
View
13 cefclient/client_handler.h
@@ -6,9 +6,12 @@
#define _CLIENT_HANDLER_H
#include "include/cef.h"
+#include "include/cef_wrapper.h"
#include "download_handler.h"
#include "util.h"
-
+#include "client_handler.h"
+#include "resource.h"
+#include "client_popup_handler.h"
// Define this value to redirect all popup URLs to the main application browser
// window.
@@ -26,6 +29,7 @@ class ClientHandler : public CefClient,
public CefPrintHandler,
public CefV8ContextHandler,
public CefDragHandler,
+ public CefMenuHandler,
public DownloadListener
{
public:
@@ -51,6 +55,8 @@ class ClientHandler : public CefClient,
{ return this; }
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE
{ return this; }
+ virtual CefRefPtr<CefMenuHandler> GetMenuHandler() OVERRIDE
+ { return this; }
// CefLifeSpanHandler methods
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
@@ -99,6 +105,11 @@ class ClientHandler : public CefClient,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) OVERRIDE;
+ // CefMenuHandler methods.
+ virtual bool OnBeforeMenu(CefRefPtr<CefBrowser> browser,
+ const CefMenuInfo& menuInfo) OVERRIDE;
+
+
// DownloadListener methods
virtual void NotifyDownloadComplete(const CefString& fileName) OVERRIDE;
virtual void NotifyDownloadError(const CefString& fileName) OVERRIDE;
View
51 cefclient/client_handler_win.cpp
@@ -1,51 +0,0 @@
-// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
-// reserved. Use of this source code is governed by a BSD-style license that
-// can be found in the LICENSE file.
-
-#include "include/cef.h"
-#include "include/cef_wrapper.h"
-#include "client_handler.h"
-#include "resource.h"
-#include "client_popup_handler.h"
-
-bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
- const CefPopupFeatures& popupFeatures,
- CefWindowInfo& windowInfo,
- const CefString& url,
- CefRefPtr<CefClient>& client,
- CefBrowserSettings& settings)
-{
- REQUIRE_UI_THREAD();
- std::string urlStr = url;
- if(urlStr.find("chrome-devtools:") == std::string::npos) {
- // Show all popup windows excluding DevTools in the current window.
- windowInfo.m_dwStyle &= ~WS_VISIBLE;
- client = new ClientPopupHandler(m_Browser);
- }
- return false;
-}
-
-void ClientHandler::SendNotification(NotificationType type)
-{
- UINT id;
- switch(type)
- {
- case NOTIFY_CONSOLE_MESSAGE:
- id = ID_WARN_CONSOLEMESSAGE;
- break;
- case NOTIFY_DOWNLOAD_COMPLETE:
- id = ID_WARN_DOWNLOADCOMPLETE;
- break;
- case NOTIFY_DOWNLOAD_ERROR:
- id = ID_WARN_DOWNLOADERROR;
- break;
- default:
- return;
- }
- PostMessage(m_MainHwnd, WM_COMMAND, id, 0);
-}
-
-void ClientHandler::CloseMainWindow()
-{
- ::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0);
-}
Please sign in to comment.
Something went wrong with that request. Please try again.