Merge the logic of managing ViewsDelegate

This commit is contained in:
Cheng Zhao 2018-04-19 15:38:33 +09:00
parent 9bc79f840e
commit 1c6c75da4f
4 changed files with 12 additions and 18 deletions

View file

@ -37,6 +37,8 @@
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "atom/browser/ui/cocoa/views_delegate_mac.h" #include "atom/browser/ui/cocoa/views_delegate_mac.h"
#else
#include "brightray/browser/views/views_delegate.h"
#endif #endif
// Must be included after all other headers. // Must be included after all other headers.
@ -181,6 +183,8 @@ void AtomBrowserMainParts::ToolkitInitialized() {
brightray::BrowserMainParts::ToolkitInitialized(); brightray::BrowserMainParts::ToolkitInitialized();
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
views_delegate_.reset(new ViewsDelegateMac); views_delegate_.reset(new ViewsDelegateMac);
#else
views_delegate_.reset(new brightray::ViewsDelegate);
#endif #endif
} }

View file

@ -15,6 +15,12 @@
class BrowserProcess; class BrowserProcess;
#if defined(TOOLKIT_VIEWS)
namespace brightray {
class ViewsDelegate;
}
#endif
namespace atom { namespace atom {
class AtomBindings; class AtomBindings;
@ -76,6 +82,8 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
std::unique_ptr<ViewsDelegateMac> views_delegate_; std::unique_ptr<ViewsDelegateMac> views_delegate_;
#else
std::unique_ptr<brightray::ViewsDelegate> views_delegate_;
#endif #endif
// A fake BrowserProcess object that used to feed the source code from chrome. // A fake BrowserProcess object that used to feed the source code from chrome.

View file

@ -43,10 +43,6 @@
#include "ui/wm/core/wm_state.h" #include "ui/wm/core/wm_state.h"
#endif #endif
#if defined(TOOLKIT_VIEWS)
#include "brightray/browser/views/views_delegate.h"
#endif
#if defined(USE_X11) #if defined(USE_X11)
#include "base/environment.h" #include "base/environment.h"
#include "base/nix/xdg_util.h" #include "base/nix/xdg_util.h"
@ -209,10 +205,6 @@ void BrowserMainParts::ToolkitInitialized() {
wm_state_.reset(new wm::WMState); wm_state_.reset(new wm::WMState);
#endif #endif
#if defined(TOOLKIT_VIEWS)
views_delegate_.reset(new ViewsDelegate);
#endif
#if defined(OS_WIN) #if defined(OS_WIN)
gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont;
gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize;

View file

@ -16,12 +16,6 @@
#include "content/public/browser/browser_main_parts.h" #include "content/public/browser/browser_main_parts.h"
#include "ui/views/layout/layout_provider.h" #include "ui/views/layout/layout_provider.h"
#if defined(TOOLKIT_VIEWS)
namespace brightray {
class ViewsDelegate;
}
#endif
#if defined(USE_AURA) #if defined(USE_AURA)
namespace wm { namespace wm {
class WMState; class WMState;
@ -56,10 +50,6 @@ class BrowserMainParts : public content::BrowserMainParts {
std::unique_ptr<IOThread> io_thread_; std::unique_ptr<IOThread> io_thread_;
#if defined(TOOLKIT_VIEWS)
std::unique_ptr<ViewsDelegate> views_delegate_;
#endif
#if defined(USE_AURA) #if defined(USE_AURA)
std::unique_ptr<wm::WMState> wm_state_; std::unique_ptr<wm::WMState> wm_state_;
#endif #endif