Merge pull request #287 from electron/no-anonymous-ns-in-header

Don't use anonymous namespace in header file.
This commit is contained in:
Kevin Sawicki 2017-04-03 08:27:51 -07:00 committed by GitHub
commit 0981807261
2 changed files with 11 additions and 18 deletions

View file

@ -24,8 +24,7 @@ class DevToolsWindowDelegate : public views::ClientView,
: views::ClientView(widget, view), : views::ClientView(widget, view),
shell_(shell), shell_(shell),
view_(view), view_(view),
widget_(widget), widget_(widget) {
title_(base::ASCIIToUTF16("Developer Tools")) {
// A WidgetDelegate should be deleted on DeleteDelegate. // A WidgetDelegate should be deleted on DeleteDelegate.
set_owned_by_client(); set_owned_by_client();
@ -34,15 +33,13 @@ class DevToolsWindowDelegate : public views::ClientView,
} }
virtual ~DevToolsWindowDelegate() {} virtual ~DevToolsWindowDelegate() {}
void SetWindowTitle(const base::string16& title) { title_ = title; }
// views::WidgetDelegate: // views::WidgetDelegate:
void DeleteDelegate() override { delete this; } void DeleteDelegate() override { delete this; }
views::View* GetInitiallyFocusedView() override { return view_; } views::View* GetInitiallyFocusedView() override { return view_; }
bool CanResize() const override { return true; } bool CanResize() const override { return true; }
bool CanMaximize() const override { return true; } bool CanMaximize() const override { return true; }
bool CanMinimize() const override { return true; } bool CanMinimize() const override { return true; }
base::string16 GetWindowTitle() const override { return title_; } base::string16 GetWindowTitle() const override { return shell_->GetTitle(); }
gfx::ImageSkia GetWindowAppIcon() override { return GetWindowIcon(); } gfx::ImageSkia GetWindowAppIcon() override { return GetWindowIcon(); }
gfx::ImageSkia GetWindowIcon() override { return icon_; } gfx::ImageSkia GetWindowIcon() override { return icon_; }
views::Widget* GetWidget() override { return widget_; } views::Widget* GetWidget() override { return widget_; }
@ -62,7 +59,6 @@ class DevToolsWindowDelegate : public views::ClientView,
InspectableWebContentsViewViews* shell_; InspectableWebContentsViewViews* shell_;
views::View* view_; views::View* view_;
views::Widget* widget_; views::Widget* widget_;
base::string16 title_;
gfx::ImageSkia icon_; gfx::ImageSkia icon_;
DISALLOW_COPY_AND_ASSIGN(DevToolsWindowDelegate); DISALLOW_COPY_AND_ASSIGN(DevToolsWindowDelegate);
@ -82,7 +78,8 @@ InspectableWebContentsViewViews::InspectableWebContentsViewViews(
contents_web_view_(nullptr), contents_web_view_(nullptr),
devtools_web_view_(new views::WebView(nullptr)), devtools_web_view_(new views::WebView(nullptr)),
devtools_visible_(false), devtools_visible_(false),
devtools_window_delegate_(nullptr) { devtools_window_delegate_(nullptr),
title_(base::ASCIIToUTF16("Developer Tools")) {
set_owned_by_client(); set_owned_by_client();
if (inspectable_web_contents_->GetWebContents()->GetNativeView()) { if (inspectable_web_contents_->GetWebContents()->GetNativeView()) {
@ -178,7 +175,7 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) {
views::Widget::InitParams params; views::Widget::InitParams params;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.delegate = GetDevToolsWindowDelegate(); params.delegate = devtools_window_delegate_;
params.bounds = inspectable_web_contents()->GetDevToolsBounds(); params.bounds = inspectable_web_contents()->GetDevToolsBounds();
#if defined(USE_X11) #if defined(USE_X11)
@ -203,7 +200,7 @@ void InspectableWebContentsViewViews::SetContentsResizingStrategy(
void InspectableWebContentsViewViews::SetTitle(const base::string16& title) { void InspectableWebContentsViewViews::SetTitle(const base::string16& title) {
if (devtools_window_) { if (devtools_window_) {
GetDevToolsWindowDelegate()->SetWindowTitle(title); title_ = title;
devtools_window_->UpdateWindowTitle(); devtools_window_->UpdateWindowTitle();
} }
} }

View file

@ -10,14 +10,11 @@
namespace views { namespace views {
class WebView; class WebView;
class Widget; class Widget;
class WidgetDelegate;
} }
namespace brightray { namespace brightray {
namespace { // NOLINT
class DevToolsWindowDelegate;
}
class InspectableWebContentsImpl; class InspectableWebContentsImpl;
class InspectableWebContentsViewViews : public InspectableWebContentsView, class InspectableWebContentsViewViews : public InspectableWebContentsView,
@ -27,10 +24,6 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
InspectableWebContentsImpl* inspectable_web_contents_impl); InspectableWebContentsImpl* inspectable_web_contents_impl);
~InspectableWebContentsViewViews(); ~InspectableWebContentsViewViews();
DevToolsWindowDelegate* GetDevToolsWindowDelegate() const {
return devtools_window_delegate_;
}
// InspectableWebContentsView: // InspectableWebContentsView:
views::View* GetView() override; views::View* GetView() override;
views::View* GetWebView() override; views::View* GetWebView() override;
@ -47,6 +40,8 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
return inspectable_web_contents_; return inspectable_web_contents_;
} }
const base::string16& GetTitle() const { return title_; }
private: private:
// views::View: // views::View:
void Layout() override; void Layout() override;
@ -61,7 +56,8 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
DevToolsContentsResizingStrategy strategy_; DevToolsContentsResizingStrategy strategy_;
bool devtools_visible_; bool devtools_visible_;
DevToolsWindowDelegate* devtools_window_delegate_; views::WidgetDelegate* devtools_window_delegate_;
base::string16 title_;
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews); DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews);
}; };