From 96de22ba5f95192f91627fcafbd3bf6ad52cbd3c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 22 Mar 2017 12:53:55 -0700 Subject: [PATCH 1/9] Use cpplint from depot_tools --- brightray/.gitmodules | 3 --- brightray/script/cpplint | 2 +- brightray/vendor/google-styleguide | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) delete mode 160000 brightray/vendor/google-styleguide diff --git a/brightray/.gitmodules b/brightray/.gitmodules index 719488608b..54ed18cf53 100644 --- a/brightray/.gitmodules +++ b/brightray/.gitmodules @@ -4,6 +4,3 @@ [submodule "vendor/gyp"] path = vendor/gyp url = https://github.com/electron/gyp -[submodule "vendor/google-styleguide"] - path = vendor/google-styleguide - url = https://github.com/svn2github/sgss-mirror-google-styleguide diff --git a/brightray/script/cpplint b/brightray/script/cpplint index ff09db9e7d..f3a871d6e3 100755 --- a/brightray/script/cpplint +++ b/brightray/script/cpplint @@ -7,7 +7,7 @@ import sys SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) -CPPLINT = os.path.join(SOURCE_ROOT, 'vendor', 'google-styleguide', 'trunk', 'cpplint', 'cpplint.py') +CPPLINT = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent', 'vendor', 'depot_tools', 'cpplint.py') LINE_LENGTH = 100 IGNORED_FILES = [ diff --git a/brightray/vendor/google-styleguide b/brightray/vendor/google-styleguide deleted file mode 160000 index ba88c8a53f..0000000000 --- a/brightray/vendor/google-styleguide +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ba88c8a53f1b563c43fc063cc048e5efdc238c18 From 97ced7fb077f8995685a76919a9ca5f6bb2f04ec Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 22 Mar 2017 13:07:52 -0700 Subject: [PATCH 2/9] Move cpplint config to CPPLINT.cfg file --- brightray/CPPLINT.cfg | 2 ++ brightray/script/cpplint | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-) create mode 100644 brightray/CPPLINT.cfg diff --git a/brightray/CPPLINT.cfg b/brightray/CPPLINT.cfg new file mode 100644 index 0000000000..3ca9f82ea8 --- /dev/null +++ b/brightray/CPPLINT.cfg @@ -0,0 +1,2 @@ +filter=-build/header_guard,-build/include_what_you_use,-legal/copyright,-runtime/references +linelength=100 diff --git a/brightray/script/cpplint b/brightray/script/cpplint index f3a871d6e3..8956857a67 100755 --- a/brightray/script/cpplint +++ b/brightray/script/cpplint @@ -8,21 +8,11 @@ import sys SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) CPPLINT = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent', 'vendor', 'depot_tools', 'cpplint.py') -LINE_LENGTH = 100 IGNORED_FILES = [ os.path.join('browser', 'mac', 'bry_inspectable_web_contents_view.h'), ] -FILTERS = [ - '-build/header_guard', - '-build/include_what_you_use', - '-legal/copyright', - # cpplint doesn't like the BOOL& parameters that ui::WindowImpl uses. - '-runtime/references', -] - - def main(): os.chdir(SOURCE_ROOT) files = list_files(['browser', 'common'], @@ -41,7 +31,7 @@ def list_files(directories, filters): def cpplint(files): - return subprocess.call([sys.executable, CPPLINT, '--linelength=%d' % LINE_LENGTH, '--filter=' + ','.join(FILTERS)] + list(files)) + return subprocess.call([sys.executable, CPPLINT] + list(files)) if __name__ == '__main__': From ece7698b6ac655616d02c0ff7a1f975df0bfbc14 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 23 Mar 2017 08:21:18 -0700 Subject: [PATCH 3/9] Add .clang-format file --- brightray/.clang-format | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 brightray/.clang-format diff --git a/brightray/.clang-format b/brightray/.clang-format new file mode 100644 index 0000000000..6fdf1dc888 --- /dev/null +++ b/brightray/.clang-format @@ -0,0 +1,8 @@ +# Defines the Chromium style for automatic reformatting. +# http://clang.llvm.org/docs/ClangFormatStyleOptions.html +BasedOnStyle: Chromium +# This defaults to 'Auto'. Explicitly set it for a while, so that +# 'vector >' in existing files gets formatted to +# 'vector>'. ('Auto' means that clang-format will only use +# 'int>>' if the file already contains at least one such instance.) +Standard: Cpp11 From 31cd7a28d8b71455b56885535a085f969809826b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 23 Mar 2017 08:21:41 -0700 Subject: [PATCH 4/9] Ignore more Objective-C headers --- brightray/script/cpplint | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brightray/script/cpplint b/brightray/script/cpplint index 8956857a67..964f2009fc 100755 --- a/brightray/script/cpplint +++ b/brightray/script/cpplint @@ -11,6 +11,8 @@ CPPLINT = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent', 'vendor', 'd IGNORED_FILES = [ os.path.join('browser', 'mac', 'bry_inspectable_web_contents_view.h'), + os.path.join('browser', 'mac', 'event_dispatching_window.h'), + os.path.join('browser', 'mac', 'notification_center_delegate.h'), ] def main(): From 1d42073ceb493f2c592d1e461f57dad70a58cb14 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 23 Mar 2017 09:58:59 -0700 Subject: [PATCH 5/9] Run cpplint on CI build --- brightray/script/cibuild | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brightray/script/cibuild b/brightray/script/cibuild index b16f69b1c5..c447736851 100755 --- a/brightray/script/cibuild +++ b/brightray/script/cibuild @@ -2,6 +2,8 @@ set -ex +script/cpplint + # Make cloned repository complete git fetch --unshallow origin HEAD From be0c0e278a36487fd991ef9678c60235c975d246 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 23 Mar 2017 12:48:22 -0700 Subject: [PATCH 6/9] Remove cpplint errors --- brightray/browser/linux/libnotify_loader.h | 4 +- .../devtools_network_upload_data_stream.cc | 2 +- .../browser/url_request_context_getter.cc | 6 +- .../inspectable_web_contents_view_views.h | 2 +- .../browser/win/notification_presenter_win.cc | 3 +- .../browser/win/notification_presenter_win.h | 9 +- brightray/browser/win/scoped_hstring.h | 8 +- .../browser/win/windows_toast_notification.cc | 103 ++++++++++-------- .../browser/win/windows_toast_notification.h | 75 ++++++++----- 9 files changed, 128 insertions(+), 84 deletions(-) diff --git a/brightray/browser/linux/libnotify_loader.h b/brightray/browser/linux/libnotify_loader.h index 825a349b39..48fda0b632 100644 --- a/brightray/browser/linux/libnotify_loader.h +++ b/brightray/browser/linux/libnotify_loader.h @@ -4,10 +4,10 @@ #ifndef BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ #define BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ -#include - #include +#include + class LibNotifyLoader { public: LibNotifyLoader(); diff --git a/brightray/browser/net/devtools_network_upload_data_stream.cc b/brightray/browser/net/devtools_network_upload_data_stream.cc index c6369dcb45..6687038b09 100644 --- a/brightray/browser/net/devtools_network_upload_data_stream.cc +++ b/brightray/browser/net/devtools_network_upload_data_stream.cc @@ -81,7 +81,7 @@ int DevToolsNetworkUploadDataStream::ThrottleRead(int result) { } void DevToolsNetworkUploadDataStream::ThrottleCallback( - int result, int64_t bytes) { + int result, int64_t bytes) { throttled_byte_count_ = bytes; OnReadCompleted(result); } diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index e3e7dca543..3510d00b84 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -200,7 +200,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { net::HttpUtil::GenerateAcceptLanguageHeader(accept_lang), user_agent_))); - std::unique_ptr host_resolver(net::HostResolver::CreateDefaultResolver(nullptr)); + std::unique_ptr host_resolver( + net::HostResolver::CreateDefaultResolver(nullptr)); // --host-resolver-rules if (command_line.HasSwitch(::switches::kHostResolverRules)) { @@ -301,7 +302,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { // --host-rules if (command_line.HasSwitch(switches::kHostRules)) { host_mapping_rules_.reset(new net::HostMappingRules); - host_mapping_rules_->SetRulesFromString(command_line.GetSwitchValueASCII(switches::kHostRules)); + host_mapping_rules_->SetRulesFromString( + command_line.GetSwitchValueASCII(switches::kHostRules)); network_session_params.host_mapping_rules = host_mapping_rules_.get(); } diff --git a/brightray/browser/views/inspectable_web_contents_view_views.h b/brightray/browser/views/inspectable_web_contents_view_views.h index 8205cc5f06..1af53e92fd 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.h +++ b/brightray/browser/views/inspectable_web_contents_view_views.h @@ -14,7 +14,7 @@ class Widget; namespace brightray { -namespace { +namespace { // NOLINT class DevToolsWindowDelegate; } diff --git a/brightray/browser/win/notification_presenter_win.cc b/brightray/browser/win/notification_presenter_win.cc index 018fa3212a..6e913ea37f 100644 --- a/brightray/browser/win/notification_presenter_win.cc +++ b/brightray/browser/win/notification_presenter_win.cc @@ -1,5 +1,6 @@ // Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Copyright (c) 2015 Felix Rieseberg and Jason Poon . All rights reserved. +// Copyright (c) 2015 Felix Rieseberg and +// Jason Poon . All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. diff --git a/brightray/browser/win/notification_presenter_win.h b/brightray/browser/win/notification_presenter_win.h index 7bcf1a9909..69b89f4ae5 100644 --- a/brightray/browser/win/notification_presenter_win.h +++ b/brightray/browser/win/notification_presenter_win.h @@ -1,12 +1,13 @@ // Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Copyright (c) 2015 Felix Rieseberg and Jason Poon . All rights reserved. +// Copyright (c) 2015 Felix Rieseberg and +// Jason Poon . All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. // Usage Example (JavaScript: // var windowsNotification = new Notification("Test Title", { -// body: "Hi, I'm an example body. How are you?", -// icon: "file:///C:/Path/To/Your/Image.png" +// body: "Hi, I'm an example body. How are you?", +// icon: "file:///C:/Path/To/Your/Image.png" // }); // windowsNotification.onshow = function () { console.log("Notification shown") }; @@ -40,6 +41,6 @@ class NotificationPresenterWin : public NotificationPresenter { DISALLOW_COPY_AND_ASSIGN(NotificationPresenterWin); }; -} // namespace +} // namespace brightray #endif // BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ diff --git a/brightray/browser/win/scoped_hstring.h b/brightray/browser/win/scoped_hstring.h index 67e4fe67fd..879e62cd39 100644 --- a/brightray/browser/win/scoped_hstring.h +++ b/brightray/browser/win/scoped_hstring.h @@ -5,18 +5,18 @@ #ifndef BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_ #define BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_ -#include - #include #include +#include + #include "base/macros.h" class ScopedHString { public: // Copy from |source|. - ScopedHString(const wchar_t* source); - ScopedHString(const std::wstring& source); + explicit ScopedHString(const wchar_t* source); + explicit ScopedHString(const std::wstring& source); // Create empty string. ScopedHString(); ~ScopedHString(); diff --git a/brightray/browser/win/windows_toast_notification.cc b/brightray/browser/win/windows_toast_notification.cc index 4d4b5bfc34..4a3a5a6f67 100644 --- a/brightray/browser/win/windows_toast_notification.cc +++ b/brightray/browser/win/windows_toast_notification.cc @@ -1,6 +1,9 @@ -// Copyright (c) 2015 Felix Rieseberg and Jason Poon . All rights reserved. -// Copyright (c) 2015 Ryan McShane and Brandon Smith -// Thanks to both of those folks mentioned above who first thought up a bunch of this code +// Copyright (c) 2015 Felix Rieseberg and Jason Poon +// . All rights reserved. +// Copyright (c) 2015 Ryan McShane and Brandon Smith +// +// Thanks to both of those folks mentioned above who first thought up a bunch of +// this code // and released it as MIT to the world. #include "browser/win/windows_toast_notification.h" @@ -14,7 +17,13 @@ #include "common/application_info.h" #include "content/public/browser/browser_thread.h" -using namespace ABI::Windows::Data::Xml::Dom; +using ABI::Windows::Data::Xml::Dom::IXmlAttribute; +using ABI::Windows::Data::Xml::Dom::IXmlDocument; +using ABI::Windows::Data::Xml::Dom::IXmlElement; +using ABI::Windows::Data::Xml::Dom::IXmlNamedNodeMap; +using ABI::Windows::Data::Xml::Dom::IXmlNode; +using ABI::Windows::Data::Xml::Dom::IXmlNodeList; +using ABI::Windows::Data::Xml::Dom::IXmlText; namespace brightray { @@ -71,8 +80,7 @@ bool WindowsToastNotification::Initialize() { WindowsToastNotification::WindowsToastNotification( NotificationDelegate* delegate, NotificationPresenter* presenter) - : Notification(delegate, presenter) { -} + : Notification(delegate, presenter) {} WindowsToastNotification::~WindowsToastNotification() { // Remove the notification on exit. @@ -82,18 +90,18 @@ WindowsToastNotification::~WindowsToastNotification() { } } -void WindowsToastNotification::Show( - const base::string16& title, - const base::string16& msg, - const std::string& tag, - const GURL& icon_url, - const SkBitmap& icon, - const bool silent) { +void WindowsToastNotification::Show(const base::string16& title, + const base::string16& msg, + const std::string& tag, + const GURL& icon_url, + const SkBitmap& icon, + const bool silent) { auto presenter_win = static_cast(presenter()); std::wstring icon_path = presenter_win->SaveIconToFilesystem(icon, icon_url); ComPtr toast_xml; - if(FAILED(GetToastXml(toast_manager_.Get(), title, msg, icon_path, silent, &toast_xml))) { + if (FAILED(GetToastXml(toast_manager_.Get(), title, msg, icon_path, silent, + &toast_xml))) { NotificationFailed(); return; } @@ -105,7 +113,8 @@ void WindowsToastNotification::Show( return; } - ComPtr toast_factory; + ComPtr + toast_factory; if (FAILED(Windows::Foundation::GetActivationFactory(toast_str, &toast_factory))) { NotificationFailed(); @@ -136,7 +145,8 @@ void WindowsToastNotification::Dismiss() { } bool WindowsToastNotification::GetToastXml( - ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* toastManager, + ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* + toastManager, const std::wstring& title, const std::wstring& msg, const std::wstring& icon_path, @@ -145,16 +155,22 @@ bool WindowsToastNotification::GetToastXml( ABI::Windows::UI::Notifications::ToastTemplateType template_type; if (title.empty() || msg.empty()) { // Single line toast. - template_type = icon_path.empty() ? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText01 : - ABI::Windows::UI::Notifications::ToastTemplateType_ToastImageAndText01; + template_type = + icon_path.empty() + ? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText01 + : ABI::Windows::UI::Notifications:: + ToastTemplateType_ToastImageAndText01; if (FAILED(toast_manager_->GetTemplateContent(template_type, toast_xml))) return false; if (!SetXmlText(*toast_xml, title.empty() ? msg : title)) return false; } else { // Title and body toast. - template_type = icon_path.empty() ? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText02 : - ABI::Windows::UI::Notifications::ToastTemplateType_ToastImageAndText02; + template_type = + icon_path.empty() + ? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText02 + : ABI::Windows::UI::Notifications:: + ToastTemplateType_ToastImageAndText02; if (FAILED(toastManager->GetTemplateContent(template_type, toast_xml))) return false; if (!SetXmlText(*toast_xml, title, msg)) @@ -174,9 +190,8 @@ bool WindowsToastNotification::GetToastXml( return true; } -bool WindowsToastNotification::SetXmlAudioSilent( - IXmlDocument* doc) { - ScopedHString tag(L"toast"); +bool WindowsToastNotification::SetXmlAudioSilent(IXmlDocument* doc) { + ScopedHString tag(L"toast"); if (!tag.success()) return false; @@ -230,15 +245,17 @@ bool WindowsToastNotification::SetXmlAudioSilent( return false; ComPtr child_node; - if (FAILED(silent_attribute_node->AppendChild(silent_node.Get(), &child_node))) + if (FAILED( + silent_attribute_node->AppendChild(silent_node.Get(), &child_node))) return false; ComPtr silent_attribute_pnode; - return SUCCEEDED(attributes.Get()->SetNamedItem(silent_attribute_node.Get(), &silent_attribute_pnode)); + return SUCCEEDED(attributes.Get()->SetNamedItem(silent_attribute_node.Get(), + &silent_attribute_pnode)); } -bool WindowsToastNotification::SetXmlText( - IXmlDocument* doc, const std::wstring& text) { +bool WindowsToastNotification::SetXmlText(IXmlDocument* doc, + const std::wstring& text) { ScopedHString tag; ComPtr node_list; if (!GetTextNodeList(&tag, doc, &node_list, 1)) @@ -251,8 +268,9 @@ bool WindowsToastNotification::SetXmlText( return AppendTextToXml(doc, node.Get(), text); } -bool WindowsToastNotification::SetXmlText( - IXmlDocument* doc, const std::wstring& title, const std::wstring& body) { +bool WindowsToastNotification::SetXmlText(IXmlDocument* doc, + const std::wstring& title, + const std::wstring& body) { ScopedHString tag; ComPtr node_list; if (!GetTextNodeList(&tag, doc, &node_list, 2)) @@ -271,8 +289,8 @@ bool WindowsToastNotification::SetXmlText( return AppendTextToXml(doc, node.Get(), body); } -bool WindowsToastNotification::SetXmlImage( - IXmlDocument* doc, const std::wstring& icon_path) { +bool WindowsToastNotification::SetXmlImage(IXmlDocument* doc, + const std::wstring& icon_path) { ScopedHString tag(L"image"); if (!tag.success()) return false; @@ -313,11 +331,10 @@ bool WindowsToastNotification::SetXmlImage( return SUCCEEDED(src_attr->AppendChild(src_node.Get(), &child_node)); } -bool WindowsToastNotification::GetTextNodeList( - ScopedHString* tag, - IXmlDocument* doc, - IXmlNodeList** node_list, - uint32_t req_length) { +bool WindowsToastNotification::GetTextNodeList(ScopedHString* tag, + IXmlDocument* doc, + IXmlNodeList** node_list, + uint32_t req_length) { tag->Reset(L"text"); if (!tag->success()) return false; @@ -332,8 +349,9 @@ bool WindowsToastNotification::GetTextNodeList( return node_length >= req_length; } -bool WindowsToastNotification::AppendTextToXml( - IXmlDocument* doc, IXmlNode* node, const std::wstring& text) { +bool WindowsToastNotification::AppendTextToXml(IXmlDocument* doc, + IXmlNode* node, + const std::wstring& text) { ScopedHString str(text); if (!str.success()) return false; @@ -377,14 +395,13 @@ bool WindowsToastNotification::RemoveCallbacks( / Toast Event Handler */ ToastEventHandler::ToastEventHandler(Notification* notification) - : notification_(notification->GetWeakPtr()) { -} + : notification_(notification->GetWeakPtr()) {} -ToastEventHandler::~ToastEventHandler() { -} +ToastEventHandler::~ToastEventHandler() {} IFACEMETHODIMP ToastEventHandler::Invoke( - ABI::Windows::UI::Notifications::IToastNotification* sender, IInspectable* args) { + ABI::Windows::UI::Notifications::IToastNotification* sender, + IInspectable* args) { content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::Bind(&Notification::NotificationClicked, notification_)); diff --git a/brightray/browser/win/windows_toast_notification.h b/brightray/browser/win/windows_toast_notification.h index fcbe78faa4..47c7d596a8 100644 --- a/brightray/browser/win/windows_toast_notification.h +++ b/brightray/browser/win/windows_toast_notification.h @@ -1,6 +1,9 @@ -// Copyright (c) 2015 Felix Rieseberg and Jason Poon . All rights reserved. -// Copyright (c) 2015 Ryan McShane and Brandon Smith -// Thanks to both of those folks mentioned above who first thought up a bunch of this code +// Copyright (c) 2015 Felix Rieseberg and Jason Poon +// . All rights reserved. +// Copyright (c) 2015 Ryan McShane and Brandon Smith +// +// Thanks to both of those folks mentioned above who first thought up a bunch of +// this code // and released it as MIT to the world. #ifndef BRIGHTRAY_BROWSER_WIN_WINDOWS_TOAST_NOTIFICATION_H_ @@ -12,21 +15,28 @@ #include "browser/notification.h" -using namespace Microsoft::WRL; +using Microsoft::WRL::ClassicCom; +using Microsoft::WRL::ComPtr; +using Microsoft::WRL::Make; +using Microsoft::WRL::RuntimeClass; +using Microsoft::WRL::RuntimeClassFlags; class ScopedHString; namespace brightray { using DesktopToastActivatedEventHandler = - ABI::Windows::Foundation::ITypedEventHandler; + ABI::Windows::Foundation::ITypedEventHandler< + ABI::Windows::UI::Notifications::ToastNotification*, + IInspectable*>; using DesktopToastDismissedEventHandler = - ABI::Windows::Foundation::ITypedEventHandler; + ABI::Windows::Foundation::ITypedEventHandler< + ABI::Windows::UI::Notifications::ToastNotification*, + ABI::Windows::UI::Notifications::ToastDismissedEventArgs*>; using DesktopToastFailedEventHandler = - ABI::Windows::Foundation::ITypedEventHandler; + ABI::Windows::Foundation::ITypedEventHandler< + ABI::Windows::UI::Notifications::ToastNotification*, + ABI::Windows::UI::Notifications::ToastFailedEventArgs*>; class WindowsToastNotification : public Notification { public: @@ -50,12 +60,14 @@ class WindowsToastNotification : public Notification { private: friend class ToastEventHandler; - bool GetToastXml(ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* toastManager, - const std::wstring& title, - const std::wstring& msg, - const std::wstring& icon_path, - const bool silent, - ABI::Windows::Data::Xml::Dom::IXmlDocument** toastXml); + bool GetToastXml( + ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* + toastManager, + const std::wstring& title, + const std::wstring& msg, + const std::wstring& icon_path, + const bool silent, + ABI::Windows::Data::Xml::Dom::IXmlDocument** toastXml); bool SetXmlAudioSilent(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc); bool SetXmlText(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, const std::wstring& text); @@ -71,34 +83,45 @@ class WindowsToastNotification : public Notification { bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, ABI::Windows::Data::Xml::Dom::IXmlNode* node, const std::wstring& text); - bool SetupCallbacks(ABI::Windows::UI::Notifications::IToastNotification* toast); - bool RemoveCallbacks(ABI::Windows::UI::Notifications::IToastNotification* toast); + bool SetupCallbacks( + ABI::Windows::UI::Notifications::IToastNotification* toast); + bool RemoveCallbacks( + ABI::Windows::UI::Notifications::IToastNotification* toast); - static ComPtr toast_manager_; - static ComPtr toast_notifier_; + static ComPtr< + ABI::Windows::UI::Notifications::IToastNotificationManagerStatics> + toast_manager_; + static ComPtr + toast_notifier_; EventRegistrationToken activated_token_; EventRegistrationToken dismissed_token_; EventRegistrationToken failed_token_; ComPtr event_handler_; - ComPtr toast_notification_; + ComPtr + toast_notification_; DISALLOW_COPY_AND_ASSIGN(WindowsToastNotification); }; - class ToastEventHandler : public RuntimeClass, DesktopToastActivatedEventHandler, DesktopToastDismissedEventHandler, DesktopToastFailedEventHandler> { public: - ToastEventHandler(Notification* notification); + explicit ToastEventHandler(Notification* notification); ~ToastEventHandler(); - IFACEMETHODIMP Invoke(ABI::Windows::UI::Notifications::IToastNotification* sender, IInspectable* args); - IFACEMETHODIMP Invoke(ABI::Windows::UI::Notifications::IToastNotification* sender, ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e); - IFACEMETHODIMP Invoke(ABI::Windows::UI::Notifications::IToastNotification* sender, ABI::Windows::UI::Notifications::IToastFailedEventArgs* e); + IFACEMETHODIMP Invoke( + ABI::Windows::UI::Notifications::IToastNotification* sender, + IInspectable* args); + IFACEMETHODIMP Invoke( + ABI::Windows::UI::Notifications::IToastNotification* sender, + ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e); + IFACEMETHODIMP Invoke( + ABI::Windows::UI::Notifications::IToastNotification* sender, + ABI::Windows::UI::Notifications::IToastFailedEventArgs* e); private: base::WeakPtr notification_; // weak ref. From 2ece711c2e3a880950164d3a1680ed909a3f3751 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 23 Mar 2017 15:47:30 -0700 Subject: [PATCH 7/9] Format line length to 80 instead of 100 --- brightray/CPPLINT.cfg | 1 - brightray/browser/browser_client.cc | 3 +- brightray/browser/browser_client.h | 3 +- brightray/browser/browser_context.cc | 10 ++- brightray/browser/inspectable_web_contents.h | 3 +- .../browser/inspectable_web_contents_impl.cc | 74 +++++++++++-------- .../browser/inspectable_web_contents_impl.h | 3 +- brightray/browser/linux/libnotify_loader.cc | 9 ++- brightray/browser/linux/libnotify_loader.h | 9 ++- .../browser/linux/libnotify_notification.cc | 3 +- .../media/media_stream_devices_controller.cc | 6 +- .../browser/net/devtools_network_controller.h | 5 +- .../net/devtools_network_controller_handle.h | 5 +- .../net/devtools_network_protocol_handler.cc | 3 +- .../devtools_network_transaction_factory.h | 7 +- brightray/browser/net_log.cc | 3 +- brightray/browser/network_delegate.cc | 3 +- brightray/browser/permission_manager.h | 11 ++- .../browser/platform_notification_service.cc | 6 +- .../browser/url_request_context_getter.cc | 27 ++++--- .../browser/url_request_context_getter.h | 6 +- .../inspectable_web_contents_view_views.cc | 29 +++++--- brightray/browser/views/views_delegate.cc | 3 +- .../browser/win/notification_presenter_win.cc | 3 +- .../browser/win/notification_presenter_win.h | 12 ++- brightray/common/main_delegate.cc | 7 +- brightray/common/switches.cc | 3 +- 27 files changed, 161 insertions(+), 96 deletions(-) diff --git a/brightray/CPPLINT.cfg b/brightray/CPPLINT.cfg index 3ca9f82ea8..01e99482f2 100644 --- a/brightray/CPPLINT.cfg +++ b/brightray/CPPLINT.cfg @@ -1,2 +1 @@ filter=-build/header_guard,-build/include_what_you_use,-legal/copyright,-runtime/references -linelength=100 diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index c34b6613d3..8c39df65cc 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -68,7 +68,8 @@ content::MediaObserver* BrowserClient::GetMediaObserver() { return MediaCaptureDevicesDispatcher::GetInstance(); } -content::PlatformNotificationService* BrowserClient::GetPlatformNotificationService() { +content::PlatformNotificationService* +BrowserClient::GetPlatformNotificationService() { if (!notification_service_) notification_service_.reset(new PlatformNotificationService(this)); return notification_service_.get(); diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index e810a44fad..574103b91c 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -39,7 +39,8 @@ class BrowserClient : public content::ContentBrowserClient { content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams&) override; content::MediaObserver* GetMediaObserver() override; - content::PlatformNotificationService* GetPlatformNotificationService() override; + content::PlatformNotificationService* GetPlatformNotificationService() + override; void GetAdditionalAllowedSchemesForFileSystem( std::vector* additional_schemes) override; net::NetLog* GetNetLog() override; diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 2a17e32745..46f76302d7 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -94,7 +94,8 @@ BrowserContext::BrowserContext(const std::string& partition, bool in_memory) if (!in_memory_ && !partition.empty()) path_ = path_.Append(FILE_PATH_LITERAL("Partitions")) - .Append(base::FilePath::FromUTF8Unsafe(MakePartitionName(partition))); + .Append(base::FilePath::FromUTF8Unsafe( + MakePartitionName(partition))); content::BrowserContext::Initialize(this, path_); @@ -168,8 +169,8 @@ base::FilePath BrowserContext::GetPath() const { return path_; } -std::unique_ptr BrowserContext::CreateZoomLevelDelegate( - const base::FilePath& partition_path) { +std::unique_ptr +BrowserContext::CreateZoomLevelDelegate(const base::FilePath& partition_path) { if (!IsOffTheRecord()) { return base::MakeUnique(prefs(), partition_path); } @@ -210,7 +211,8 @@ content::PermissionManager* BrowserContext::GetPermissionManager() { return permission_manager_.get(); } -content::BackgroundSyncController* BrowserContext::GetBackgroundSyncController() { +content::BackgroundSyncController* +BrowserContext::GetBackgroundSyncController() { return nullptr; } diff --git a/brightray/browser/inspectable_web_contents.h b/brightray/browser/inspectable_web_contents.h index a862344e2f..44c0c22ec6 100644 --- a/brightray/browser/inspectable_web_contents.h +++ b/brightray/browser/inspectable_web_contents.h @@ -18,7 +18,8 @@ class InspectableWebContentsView; class InspectableWebContents { public: - static InspectableWebContents* Create(const content::WebContents::CreateParams&); + static InspectableWebContents* Create( + const content::WebContents::CreateParams&); // The returned InspectableWebContents takes ownership of the passed-in // WebContents. diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 4f4100eb67..540cb2feb7 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -136,7 +136,8 @@ GURL GetDevToolsURL(bool can_dock) { class ResponseWriter : public net::URLFetcherResponseWriter { public: - ResponseWriter(base::WeakPtr bindings, int stream_id); + ResponseWriter(base::WeakPtr bindings, + int stream_id); ~ResponseWriter() override; // URLFetcherResponseWriter overrides: @@ -153,8 +154,9 @@ class ResponseWriter : public net::URLFetcherResponseWriter { DISALLOW_COPY_AND_ASSIGN(ResponseWriter); }; -ResponseWriter::ResponseWriter(base::WeakPtr bindings, - int stream_id) +ResponseWriter::ResponseWriter( + base::WeakPtr bindings, + int stream_id) : bindings_(bindings), stream_id_(stream_id) { } @@ -207,7 +209,8 @@ InspectableWebContentsImpl::InspectableWebContentsImpl( delegate_(nullptr), web_contents_(web_contents), weak_factory_(this) { - auto context = static_cast(web_contents_->GetBrowserContext()); + auto context = + static_cast(web_contents_->GetBrowserContext()); pref_service_ = context->prefs(); auto bounds_dict = pref_service_->GetDictionary(kDevToolsBoundsPref); if (bounds_dict) { @@ -226,8 +229,10 @@ InspectableWebContentsImpl::InspectableWebContentsImpl( display = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); } - devtools_bounds_.set_x(display.x() + (display.width() - devtools_bounds_.width()) / 2); - devtools_bounds_.set_y(display.y() + (display.height() - devtools_bounds_.height()) / 2); + devtools_bounds_.set_x(display.x() + + (display.width() - devtools_bounds_.width()) / 2); + devtools_bounds_.set_y( + display.y() + (display.height() - devtools_bounds_.height()) / 2); } } @@ -246,7 +251,8 @@ content::WebContents* InspectableWebContentsImpl::GetWebContents() const { return web_contents_.get(); } -content::WebContents* InspectableWebContentsImpl::GetDevToolsWebContents() const { +content::WebContents* InspectableWebContentsImpl::GetDevToolsWebContents() + const { return devtools_web_contents_.get(); } @@ -255,11 +261,13 @@ void InspectableWebContentsImpl::InspectElement(int x, int y) { agent_host_->InspectElement(this, x, y); } -void InspectableWebContentsImpl::SetDelegate(InspectableWebContentsDelegate* delegate) { +void InspectableWebContentsImpl::SetDelegate( + InspectableWebContentsDelegate* delegate) { delegate_ = delegate; } -InspectableWebContentsDelegate* InspectableWebContentsImpl::GetDelegate() const { +InspectableWebContentsDelegate* InspectableWebContentsImpl::GetDelegate() + const { return delegate_; } @@ -279,7 +287,8 @@ void InspectableWebContentsImpl::ShowDevTools() { embedder_message_dispatcher_.reset( DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(this)); - content::WebContents::CreateParams create_params(web_contents_->GetBrowserContext()); + content::WebContents::CreateParams create_params( + web_contents_->GetBrowserContext()); devtools_web_contents_.reset(content::WebContents::Create(create_params)); Observe(devtools_web_contents_.get()); @@ -324,10 +333,11 @@ void InspectableWebContentsImpl::Detach() { agent_host_ = nullptr; } -void InspectableWebContentsImpl::CallClientFunction(const std::string& function_name, - const base::Value* arg1, - const base::Value* arg2, - const base::Value* arg3) { +void InspectableWebContentsImpl::CallClientFunction( + const std::string& function_name, + const base::Value* arg1, + const base::Value* arg2, + const base::Value* arg3) { if (!devtools_web_contents_) return; @@ -433,15 +443,17 @@ void InspectableWebContentsImpl::LoadNetworkResource( return; } - auto browser_context = static_cast(devtools_web_contents_->GetBrowserContext()); + auto browser_context = + static_cast(devtools_web_contents_->GetBrowserContext()); net::URLFetcher* fetcher = (net::URLFetcher::Create(gurl, net::URLFetcher::GET, this)).release(); pending_requests_[fetcher] = callback; fetcher->SetRequestContext(browser_context->url_request_context_getter()); fetcher->SetExtraRequestHeaders(headers); - fetcher->SaveResponseWithWriter(std::unique_ptr( - new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); + fetcher->SaveResponseWithWriter( + std::unique_ptr( + new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); fetcher->Start(); } @@ -509,7 +521,8 @@ void InspectableWebContentsImpl::SearchInPath( delegate_->DevToolsSearchInPath(request_id, file_system_path, query); } -void InspectableWebContentsImpl::SetWhitelistedShortcuts(const std::string& message) { +void InspectableWebContentsImpl::SetWhitelistedShortcuts( + const std::string& message) { } void InspectableWebContentsImpl::ZoomIn() { @@ -548,16 +561,18 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend( agent_host_->DispatchProtocolMessage(this, message); } -void InspectableWebContentsImpl::RecordActionUMA(const std::string& name, int action) { +void InspectableWebContentsImpl::RecordActionUMA(const std::string& name, + int action) { if (name == kDevToolsActionTakenHistogram) UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary); else if (name == kDevToolsPanelShownHistogram) UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary); } -void InspectableWebContentsImpl::SendJsonRequest(const DispatchCallback& callback, - const std::string& browser_id, - const std::string& url) { +void InspectableWebContentsImpl::SendJsonRequest( + const DispatchCallback& callback, + const std::string& browser_id, + const std::string& url) { callback.Run(nullptr); } @@ -584,7 +599,8 @@ void InspectableWebContentsImpl::ClearPreferences() { update.Get()->Clear(); } -void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::string& message) { +void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend( + const std::string& message) { std::string method; base::ListValue empty_params; base::ListValue* params = &empty_params; @@ -728,14 +744,14 @@ void InspectableWebContentsImpl::OnWebContentsFocused() { void InspectableWebContentsImpl::DidStartNavigationToPendingEntry( const GURL& url, content::ReloadType reload_type) { - frontend_host_.reset( - content::DevToolsFrontendHost::Create( - web_contents()->GetMainFrame(), - base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, - base::Unretained(this)))); + frontend_host_.reset(content::DevToolsFrontendHost::Create( + web_contents()->GetMainFrame(), + base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, + base::Unretained(this)))); } -void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) { +void InspectableWebContentsImpl::OnURLFetchComplete( + const net::URLFetcher* source) { DCHECK(source); auto it = pending_requests_.find(source); DCHECK(it != pending_requests_.end()); diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 9b565f0f2d..2f000c2102 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -173,7 +173,8 @@ class InspectableWebContentsImpl : bool frontend_loaded_; scoped_refptr agent_host_; std::unique_ptr frontend_host_; - std::unique_ptr embedder_message_dispatcher_; + std::unique_ptr + embedder_message_dispatcher_; DevToolsContentsResizingStrategy contents_resizing_strategy_; gfx::Rect devtools_bounds_; diff --git a/brightray/browser/linux/libnotify_loader.cc b/brightray/browser/linux/libnotify_loader.cc index 747108529a..5510bc23cf 100644 --- a/brightray/browser/linux/libnotify_loader.cc +++ b/brightray/browser/linux/libnotify_loader.cc @@ -1,5 +1,6 @@ // This is generated file. Do not modify directly. -// Path to the code generator: tools/generate_library_loader/generate_library_loader.py . +// Path to the code generator: +// tools/generate_library_loader/generate_library_loader.py . #include "browser/linux/libnotify_loader.h" @@ -68,9 +69,9 @@ bool LibNotifyLoader::Load(const std::string& library_name) { return false; } - notify_notification_set_image_from_pixbuf = - reinterpret_castnotify_notification_set_image_from_pixbuf)>( - dlsym(library_, "notify_notification_set_image_from_pixbuf")); + notify_notification_set_image_from_pixbuf = reinterpret_castnotify_notification_set_image_from_pixbuf)>( + dlsym(library_, "notify_notification_set_image_from_pixbuf")); if (!notify_notification_set_image_from_pixbuf) { CleanUp(true); return false; diff --git a/brightray/browser/linux/libnotify_loader.h b/brightray/browser/linux/libnotify_loader.h index 48fda0b632..a48f479414 100644 --- a/brightray/browser/linux/libnotify_loader.h +++ b/brightray/browser/linux/libnotify_loader.h @@ -1,5 +1,6 @@ // This is generated file. Do not modify directly. -// Path to the code generator: tools/generate_library_loader/generate_library_loader.py . +// Path to the code generator: +// tools/generate_library_loader/generate_library_loader.py . #ifndef BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ #define BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ @@ -24,9 +25,11 @@ class LibNotifyLoader { decltype(&::notify_get_server_info) notify_get_server_info; decltype(&::notify_notification_new) notify_notification_new; decltype(&::notify_notification_add_action) notify_notification_add_action; - decltype(&::notify_notification_set_image_from_pixbuf) notify_notification_set_image_from_pixbuf; + decltype(&::notify_notification_set_image_from_pixbuf) + notify_notification_set_image_from_pixbuf; decltype(&::notify_notification_set_timeout) notify_notification_set_timeout; - decltype(&::notify_notification_set_hint_string) notify_notification_set_hint_string; + decltype(&::notify_notification_set_hint_string) + notify_notification_set_hint_string; decltype(&::notify_notification_show) notify_notification_show; decltype(&::notify_notification_close) notify_notification_close; diff --git a/brightray/browser/linux/libnotify_notification.cc b/brightray/browser/linux/libnotify_notification.cc index ab296e2183..aea7b7cc42 100644 --- a/brightray/browser/linux/libnotify_notification.cc +++ b/brightray/browser/linux/libnotify_notification.cc @@ -22,7 +22,8 @@ bool HasCapability(const std::string& capability) { bool result = false; GList* capabilities = libnotify_loader_.notify_get_server_caps(); - if (g_list_find_custom(capabilities, capability.c_str(), (GCompareFunc) g_strcmp0) != NULL) + if (g_list_find_custom(capabilities, capability.c_str(), + (GCompareFunc)g_strcmp0) != NULL) result = true; g_list_free_full(capabilities, g_free); diff --git a/brightray/browser/media/media_stream_devices_controller.cc b/brightray/browser/media/media_stream_devices_controller.cc index a744a08ae4..c01749ab43 100644 --- a/brightray/browser/media/media_stream_devices_controller.cc +++ b/brightray/browser/media/media_stream_devices_controller.cc @@ -142,10 +142,12 @@ void MediaStreamDevicesController::Accept() { content::MediaResponseCallback cb = callback_; callback_.Reset(); - cb.Run(devices, content::MEDIA_DEVICE_OK, std::unique_ptr()); + cb.Run(devices, content::MEDIA_DEVICE_OK, + std::unique_ptr()); } -void MediaStreamDevicesController::Deny(content::MediaStreamRequestResult result) { +void MediaStreamDevicesController::Deny( + content::MediaStreamRequestResult result) { content::MediaResponseCallback cb = callback_; callback_.Reset(); cb.Run(content::MediaStreamDevices(), diff --git a/brightray/browser/net/devtools_network_controller.h b/brightray/browser/net/devtools_network_controller.h index 02bb698559..7e6c948b42 100644 --- a/brightray/browser/net/devtools_network_controller.h +++ b/brightray/browser/net/devtools_network_controller.h @@ -24,8 +24,9 @@ class DevToolsNetworkController { DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id); private: - using InterceptorMap = base::ScopedPtrHashMap>; + using InterceptorMap = + base::ScopedPtrHashMap>; std::unique_ptr appcache_interceptor_; InterceptorMap interceptors_; diff --git a/brightray/browser/net/devtools_network_controller_handle.h b/brightray/browser/net/devtools_network_controller_handle.h index b5c861f5cd..2d038e837f 100644 --- a/brightray/browser/net/devtools_network_controller_handle.h +++ b/brightray/browser/net/devtools_network_controller_handle.h @@ -31,8 +31,9 @@ class DevToolsNetworkControllerHandle { private: void LazyInitialize(); - void SetNetworkStateOnIO(const std::string& client_id, - std::unique_ptr conditions); + void SetNetworkStateOnIO( + const std::string& client_id, + std::unique_ptr conditions); std::unique_ptr controller_; diff --git a/brightray/browser/net/devtools_network_protocol_handler.cc b/brightray/browser/net/devtools_network_protocol_handler.cc index 584840533b..58988577b4 100644 --- a/brightray/browser/net/devtools_network_protocol_handler.cc +++ b/brightray/browser/net/devtools_network_protocol_handler.cc @@ -30,7 +30,8 @@ const char kErrorMessage[] = "message"; } // namespace params const char kEmulateNetworkConditions[] = "Network.emulateNetworkConditions"; -const char kCanEmulateNetworkConditions[] = "Network.canEmulateNetworkConditions"; +const char kCanEmulateNetworkConditions[] = + "Network.canEmulateNetworkConditions"; const char kId[] = "id"; const char kMethod[] = "method"; const char kParams[] = "params"; diff --git a/brightray/browser/net/devtools_network_transaction_factory.h b/brightray/browser/net/devtools_network_transaction_factory.h index a6c8f6a3c2..49286a0474 100644 --- a/brightray/browser/net/devtools_network_transaction_factory.h +++ b/brightray/browser/net/devtools_network_transaction_factory.h @@ -21,13 +21,14 @@ class DevToolsNetworkTransactionFactory : public net::HttpTransactionFactory { ~DevToolsNetworkTransactionFactory() override; // net::HttpTransactionFactory: - int CreateTransaction(net::RequestPriority priority, - std::unique_ptr* transaction) override; + int CreateTransaction( + net::RequestPriority priority, + std::unique_ptr* transaction) override; net::HttpCache* GetCache() override; net::HttpNetworkSession* GetSession() override; private: - DevToolsNetworkController* controller_; + DevToolsNetworkController* controller_; std::unique_ptr network_layer_; DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransactionFactory); diff --git a/brightray/browser/net_log.cc b/brightray/browser/net_log.cc index f141c7ef2e..6b41eb738c 100644 --- a/brightray/browser/net_log.cc +++ b/brightray/browser/net_log.cc @@ -40,7 +40,8 @@ void NetLog::StartLogging(net::URLRequestContext* url_request_context) { if (!command_line->HasSwitch(switches::kLogNetLog)) return; - base::FilePath log_path = command_line->GetSwitchValuePath(switches::kLogNetLog); + base::FilePath log_path = + command_line->GetSwitchValuePath(switches::kLogNetLog); #if defined(OS_WIN) log_file_.reset(_wfopen(log_path.value().c_str(), L"w")); #elif defined(OS_POSIX) diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index e0ef20bb57..2af03e0f95 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -25,7 +25,8 @@ const char kIgnoreConnectionsLimit[] = "ignore-connections-limit"; NetworkDelegate::NetworkDelegate() { auto command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(kIgnoreConnectionsLimit)) { - std::string value = command_line->GetSwitchValueASCII(kIgnoreConnectionsLimit); + std::string value = + command_line->GetSwitchValueASCII(kIgnoreConnectionsLimit); ignore_connections_limit_domains_ = base::SplitString( value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); } diff --git a/brightray/browser/permission_manager.h b/brightray/browser/permission_manager.h index 67168ed2b3..7e9a283913 100644 --- a/brightray/browser/permission_manager.h +++ b/brightray/browser/permission_manager.h @@ -22,14 +22,16 @@ class PermissionManager : public content::PermissionManager { content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, bool user_gesture, - const base::Callback& callback) override; + const base::Callback& callback) + override; int RequestPermissions( const std::vector& permissions, content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, bool user_gesture, - const base::Callback&)>& callback) override; + const base::Callback< + void(const std::vector&)>& callback) + override; void CancelPermissionRequest(int request_id) override; void ResetPermission(content::PermissionType permission, const GURL& requesting_origin, @@ -45,7 +47,8 @@ class PermissionManager : public content::PermissionManager { content::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin, - const base::Callback& callback) override; + const base::Callback& callback) + override; void UnsubscribePermissionStatusChange(int subscription_id) override; private: diff --git a/brightray/browser/platform_notification_service.cc b/brightray/browser/platform_notification_service.cc index 3fa04e0814..8f9f16a2c1 100644 --- a/brightray/browser/platform_notification_service.cc +++ b/brightray/browser/platform_notification_service.cc @@ -45,7 +45,8 @@ PlatformNotificationService::PlatformNotificationService( PlatformNotificationService::~PlatformNotificationService() {} -blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnUIThread( +blink::mojom::PermissionStatus +PlatformNotificationService::CheckPermissionOnUIThread( content::BrowserContext* browser_context, const GURL& origin, int render_process_id) { @@ -53,7 +54,8 @@ blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnUIT return blink::mojom::PermissionStatus::GRANTED; } -blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnIOThread( +blink::mojom::PermissionStatus +PlatformNotificationService::CheckPermissionOnIOThread( content::ResourceContext* resource_context, const GURL& origin, int render_process_id) { diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 3510d00b84..a9e0a22756 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -69,7 +69,8 @@ std::string URLRequestContextGetter::Delegate::GetUserAgent() { std::unique_ptr URLRequestContextGetter::Delegate::CreateURLRequestJobFactory( content::ProtocolHandlerMap* protocol_handlers) { - std::unique_ptr job_factory(new net::URLRequestJobFactoryImpl); + std::unique_ptr job_factory( + new net::URLRequestJobFactoryImpl); for (auto& it : *protocol_handlers) { job_factory->SetProtocolHandler( @@ -89,7 +90,8 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory( } net::HttpCache::BackendFactory* -URLRequestContextGetter::Delegate::CreateHttpCacheBackendFactory(const base::FilePath& base_path) { +URLRequestContextGetter::Delegate::CreateHttpCacheBackendFactory( + const base::FilePath& base_path) { base::FilePath cache_path = base_path.Append(FILE_PATH_LITERAL("Cache")); return new net::HttpCache::DefaultBackend( net::DISK_CACHE, @@ -104,11 +106,13 @@ URLRequestContextGetter::Delegate::CreateCertVerifier() { return net::CertVerifier::CreateDefault(); } -net::SSLConfigService* URLRequestContextGetter::Delegate::CreateSSLConfigService() { +net::SSLConfigService* +URLRequestContextGetter::Delegate::CreateSSLConfigService() { return new net::SSLConfigServiceDefaults; } -std::vector URLRequestContextGetter::Delegate::GetCookieableSchemes() { +std::vector +URLRequestContextGetter::Delegate::GetCookieableSchemes() { return { "http", "https", "ws", "wss" }; } @@ -177,7 +181,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { network_delegate_.reset(delegate_->CreateNetworkDelegate()); url_request_context_->set_network_delegate(network_delegate_.get()); - storage_.reset(new net::URLRequestContextStorage(url_request_context_.get())); + storage_.reset( + new net::URLRequestContextStorage(url_request_context_.get())); auto cookie_path = in_memory_ ? base::FilePath() : base_path_.Append(FILE_PATH_LITERAL("Cookies")); @@ -261,7 +266,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { // --auth-negotiate-delegate-whitelist if (command_line.HasSwitch(switches::kAuthNegotiateDelegateWhitelist)) { http_auth_preferences_->set_delegate_whitelist( - command_line.GetSwitchValueASCII(switches::kAuthNegotiateDelegateWhitelist)); + command_line.GetSwitchValueASCII( + switches::kAuthNegotiateDelegateWhitelist)); } auto auth_handler_factory = @@ -309,7 +315,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { // Give |storage_| ownership at the end in case it's |mapped_host_resolver|. storage_->set_host_resolver(std::move(host_resolver)); - network_session_params.host_resolver = url_request_context_->host_resolver(); + network_session_params.host_resolver = + url_request_context_->host_resolver(); http_network_session_.reset( new net::HttpNetworkSession(network_session_params)); @@ -324,7 +331,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { storage_->set_http_transaction_factory(base::WrapUnique( new net::HttpCache( base::WrapUnique(new DevToolsNetworkTransactionFactory( - network_controller_handle_->GetController(), http_network_session_.get())), + network_controller_handle_->GetController(), + http_network_session_.get())), std::move(backend), false))); } else { @@ -356,7 +364,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { return url_request_context_.get(); } -scoped_refptr URLRequestContextGetter::GetNetworkTaskRunner() const { +scoped_refptr +URLRequestContextGetter::GetNetworkTaskRunner() const { return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); } diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index e08189d862..c09824d44b 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -47,8 +47,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { } virtual std::string GetUserAgent(); virtual std::unique_ptr - CreateURLRequestJobFactory( - content::ProtocolHandlerMap* protocol_handlers); + CreateURLRequestJobFactory(content::ProtocolHandlerMap* protocol_handlers); virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory( const base::FilePath& base_path); virtual std::unique_ptr CreateCertVerifier(); @@ -75,7 +74,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { // net::URLRequestContextGetter: net::URLRequestContext* GetURLRequestContext() override; - scoped_refptr GetNetworkTaskRunner() const override; + scoped_refptr GetNetworkTaskRunner() + const override; net::HostResolver* host_resolver(); net::URLRequestJobFactory* job_factory() const { return job_factory_; } diff --git a/brightray/browser/views/inspectable_web_contents_view_views.cc b/brightray/browser/views/inspectable_web_contents_view_views.cc index fb1f8493cd..13efd4be75 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.cc +++ b/brightray/browser/views/inspectable_web_contents_view_views.cc @@ -48,7 +48,9 @@ class DevToolsWindowDelegate : public views::ClientView, views::Widget* GetWidget() override { return widget_; } const views::Widget* GetWidget() const override { return widget_; } views::View* GetContentsView() override { return view_; } - views::ClientView* CreateClientView(views::Widget* widget) override { return this; } + views::ClientView* CreateClientView(views::Widget* widget) override { + return this; + } // views::ClientView: bool CanClose() override { @@ -85,10 +87,12 @@ InspectableWebContentsViewViews::InspectableWebContentsViewViews( if (inspectable_web_contents_->GetWebContents()->GetNativeView()) { views::WebView* contents_web_view = new views::WebView(nullptr); - contents_web_view->SetWebContents(inspectable_web_contents_->GetWebContents()); + contents_web_view->SetWebContents( + inspectable_web_contents_->GetWebContents()); contents_web_view_ = contents_web_view; } else { - contents_web_view_ = new views::Label(base::ASCIIToUTF16("No content under offscreen mode")); + contents_web_view_ = new views::Label( + base::ASCIIToUTF16("No content under offscreen mode")); } devtools_web_view_->SetVisible(false); @@ -98,7 +102,8 @@ InspectableWebContentsViewViews::InspectableWebContentsViewViews( InspectableWebContentsViewViews::~InspectableWebContentsViewViews() { if (devtools_window_) - inspectable_web_contents()->SaveDevToolsBounds(devtools_window_->GetWindowBoundsInScreen()); + inspectable_web_contents()->SaveDevToolsBounds( + devtools_window_->GetWindowBoundsInScreen()); } views::View* InspectableWebContentsViewViews::GetView() { @@ -117,7 +122,8 @@ void InspectableWebContentsViewViews::ShowDevTools() { if (devtools_window_) { devtools_window_web_view_->SetWebContents( inspectable_web_contents_->GetDevToolsWebContents()); - devtools_window_->SetBounds(inspectable_web_contents()->GetDevToolsBounds()); + devtools_window_->SetBounds( + inspectable_web_contents()->GetDevToolsBounds()); devtools_window_->Show(); } else { devtools_web_view_->SetVisible(true); @@ -134,7 +140,8 @@ void InspectableWebContentsViewViews::CloseDevTools() { devtools_visible_ = false; if (devtools_window_) { - inspectable_web_contents()->SaveDevToolsBounds(devtools_window_->GetWindowBoundsInScreen()); + inspectable_web_contents()->SaveDevToolsBounds( + devtools_window_->GetWindowBoundsInScreen()); devtools_window_.reset(); devtools_window_web_view_ = nullptr; devtools_window_delegate_ = nullptr; @@ -164,9 +171,10 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) { if (!docked) { devtools_window_.reset(new views::Widget); devtools_window_web_view_ = new views::WebView(NULL); - devtools_window_delegate_ = new DevToolsWindowDelegate(this, - devtools_window_web_view_, - devtools_window_.get()); + devtools_window_delegate_ = new DevToolsWindowDelegate( + this, + devtools_window_web_view_ + devtools_window_.get()); views::Widget::InitParams params; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; @@ -176,7 +184,8 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) { #if defined(USE_X11) params.wm_role_name = "devtools"; if (GetDelegate()) - GetDelegate()->GetDevToolsWindowWMClass(¶ms.wm_class_name, ¶ms.wm_class_class); + GetDelegate()->GetDevToolsWindowWMClass(¶ms.wm_class_name, + ¶ms.wm_class_class); #endif devtools_window_->Init(params); diff --git a/brightray/browser/views/views_delegate.cc b/brightray/browser/views/views_delegate.cc index 8dcbe38ae2..99797dea4a 100644 --- a/brightray/browser/views/views_delegate.cc +++ b/brightray/browser/views/views_delegate.cc @@ -48,7 +48,8 @@ void ViewsDelegate::NotifyMenuItemFocused( #if defined(OS_WIN) HICON ViewsDelegate::GetDefaultWindowIcon() const { // Use current exe's icon as default window icon. - return LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(1 /* IDR_MAINFRAME */)); + return LoadIcon(GetModuleHandle(NULL), + MAKEINTRESOURCE(1 /* IDR_MAINFRAME */)); } HICON ViewsDelegate::GetSmallWindowIcon() const { diff --git a/brightray/browser/win/notification_presenter_win.cc b/brightray/browser/win/notification_presenter_win.cc index 6e913ea37f..c185246809 100644 --- a/brightray/browser/win/notification_presenter_win.cc +++ b/brightray/browser/win/notification_presenter_win.cc @@ -38,7 +38,8 @@ bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) { NotificationPresenter* NotificationPresenter::Create() { if (!WindowsToastNotification::Initialize()) return nullptr; - std::unique_ptr presenter(new NotificationPresenterWin); + std::unique_ptr presenter( + new NotificationPresenterWin); if (!presenter->Init()) return nullptr; return presenter.release(); diff --git a/brightray/browser/win/notification_presenter_win.h b/brightray/browser/win/notification_presenter_win.h index 69b89f4ae5..c3e6a9ad43 100644 --- a/brightray/browser/win/notification_presenter_win.h +++ b/brightray/browser/win/notification_presenter_win.h @@ -10,9 +10,15 @@ // icon: "file:///C:/Path/To/Your/Image.png" // }); -// windowsNotification.onshow = function () { console.log("Notification shown") }; -// windowsNotification.onclick = function () { console.log("Notification clicked") }; -// windowsNotification.onclose = function () { console.log("Notification dismissed") }; +// windowsNotification.onshow = function () { +// console.log("Notification shown") +// }; +// windowsNotification.onclick = function () { +// console.log("Notification clicked") +// }; +// windowsNotification.onclose = function () { +// console.log("Notification dismissed") +// }; #ifndef BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ #define BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index 3645f53f47..4551ddfa0a 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -61,9 +61,9 @@ void InitializeResourceBundle(const std::string& locale) { bundle.AddDataPackFromPath( pak_dir.Append(FILE_PATH_LITERAL("pdf_viewer_resources.pak")), ui::GetSupportedScaleFactors()[0]); - bundle.AddDataPackFromPath( - pak_dir.Append(FILE_PATH_LITERAL("blink_image_resources_200_percent.pak")), - ui::SCALE_FACTOR_200P); + bundle.AddDataPackFromPath(pak_dir.Append(FILE_PATH_LITERAL( + "blink_image_resources_200_percent.pak")), + ui::SCALE_FACTOR_200P); bundle.AddDataPackFromPath( pak_dir.Append(FILE_PATH_LITERAL("content_resources_200_percent.pak")), ui::SCALE_FACTOR_200P); @@ -76,7 +76,6 @@ void InitializeResourceBundle(const std::string& locale) { #endif } - MainDelegate::MainDelegate() { } diff --git a/brightray/common/switches.cc b/brightray/common/switches.cc index c46fe3bda9..1f0da2adfd 100644 --- a/brightray/common/switches.cc +++ b/brightray/common/switches.cc @@ -47,7 +47,8 @@ const char kDisableHttp2[] = "disable-http2"; const char kAuthServerWhitelist[] = "auth-server-whitelist"; // Whitelist containing servers for which Kerberos delegation is allowed. -const char kAuthNegotiateDelegateWhitelist[] = "auth-negotiate-delegate-whitelist"; +const char kAuthNegotiateDelegateWhitelist[] = + "auth-negotiate-delegate-whitelist"; // Ignores certificate-related errors. const char kIgnoreCertificateErrors[] = "ignore-certificate-errors"; From 49ef4e326f602564e9d1b2c10075b5284ffbce81 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 23 Mar 2017 15:51:25 -0700 Subject: [PATCH 8/9] Initialize submodules in appveyor build --- brightray/appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/brightray/appveyor.yml b/brightray/appveyor.yml index 46a91007e6..d623fdc8c6 100644 --- a/brightray/appveyor.yml +++ b/brightray/appveyor.yml @@ -13,6 +13,7 @@ platform: install: - cmd: SET PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH% - cmd: SET PATH=C:\python27;%PATH% + - cmd: git submodule update --init --recursive - cmd: bash script/cibuild branches: From 21956071e63013788b7aa2294ee20e79f202ebcd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 24 Mar 2017 09:52:37 -0700 Subject: [PATCH 9/9] Fix compilation issue --- brightray/browser/views/inspectable_web_contents_view_views.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/browser/views/inspectable_web_contents_view_views.cc b/brightray/browser/views/inspectable_web_contents_view_views.cc index 13efd4be75..6a9997f232 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.cc +++ b/brightray/browser/views/inspectable_web_contents_view_views.cc @@ -173,7 +173,7 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) { devtools_window_web_view_ = new views::WebView(NULL); devtools_window_delegate_ = new DevToolsWindowDelegate( this, - devtools_window_web_view_ + devtools_window_web_view_, devtools_window_.get()); views::Widget::InitParams params;