Format line length to 80 instead of 100

This commit is contained in:
Kevin Sawicki 2017-03-23 15:47:30 -07:00
parent be0c0e278a
commit 2ece711c2e
27 changed files with 161 additions and 96 deletions

View file

@ -1,2 +1 @@
filter=-build/header_guard,-build/include_what_you_use,-legal/copyright,-runtime/references filter=-build/header_guard,-build/include_what_you_use,-legal/copyright,-runtime/references
linelength=100

View file

@ -68,7 +68,8 @@ content::MediaObserver* BrowserClient::GetMediaObserver() {
return MediaCaptureDevicesDispatcher::GetInstance(); return MediaCaptureDevicesDispatcher::GetInstance();
} }
content::PlatformNotificationService* BrowserClient::GetPlatformNotificationService() { content::PlatformNotificationService*
BrowserClient::GetPlatformNotificationService() {
if (!notification_service_) if (!notification_service_)
notification_service_.reset(new PlatformNotificationService(this)); notification_service_.reset(new PlatformNotificationService(this));
return notification_service_.get(); return notification_service_.get();

View file

@ -39,7 +39,8 @@ class BrowserClient : public content::ContentBrowserClient {
content::BrowserMainParts* CreateBrowserMainParts( content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams&) override; const content::MainFunctionParams&) override;
content::MediaObserver* GetMediaObserver() override; content::MediaObserver* GetMediaObserver() override;
content::PlatformNotificationService* GetPlatformNotificationService() override; content::PlatformNotificationService* GetPlatformNotificationService()
override;
void GetAdditionalAllowedSchemesForFileSystem( void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) override; std::vector<std::string>* additional_schemes) override;
net::NetLog* GetNetLog() override; net::NetLog* GetNetLog() override;

View file

@ -94,7 +94,8 @@ BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
if (!in_memory_ && !partition.empty()) if (!in_memory_ && !partition.empty())
path_ = path_.Append(FILE_PATH_LITERAL("Partitions")) path_ = path_.Append(FILE_PATH_LITERAL("Partitions"))
.Append(base::FilePath::FromUTF8Unsafe(MakePartitionName(partition))); .Append(base::FilePath::FromUTF8Unsafe(
MakePartitionName(partition)));
content::BrowserContext::Initialize(this, path_); content::BrowserContext::Initialize(this, path_);
@ -168,8 +169,8 @@ base::FilePath BrowserContext::GetPath() const {
return path_; return path_;
} }
std::unique_ptr<content::ZoomLevelDelegate> BrowserContext::CreateZoomLevelDelegate( std::unique_ptr<content::ZoomLevelDelegate>
const base::FilePath& partition_path) { BrowserContext::CreateZoomLevelDelegate(const base::FilePath& partition_path) {
if (!IsOffTheRecord()) { if (!IsOffTheRecord()) {
return base::MakeUnique<ZoomLevelDelegate>(prefs(), partition_path); return base::MakeUnique<ZoomLevelDelegate>(prefs(), partition_path);
} }
@ -210,7 +211,8 @@ content::PermissionManager* BrowserContext::GetPermissionManager() {
return permission_manager_.get(); return permission_manager_.get();
} }
content::BackgroundSyncController* BrowserContext::GetBackgroundSyncController() { content::BackgroundSyncController*
BrowserContext::GetBackgroundSyncController() {
return nullptr; return nullptr;
} }

View file

@ -18,7 +18,8 @@ class InspectableWebContentsView;
class InspectableWebContents { class InspectableWebContents {
public: public:
static InspectableWebContents* Create(const content::WebContents::CreateParams&); static InspectableWebContents* Create(
const content::WebContents::CreateParams&);
// The returned InspectableWebContents takes ownership of the passed-in // The returned InspectableWebContents takes ownership of the passed-in
// WebContents. // WebContents.

View file

@ -136,7 +136,8 @@ GURL GetDevToolsURL(bool can_dock) {
class ResponseWriter : public net::URLFetcherResponseWriter { class ResponseWriter : public net::URLFetcherResponseWriter {
public: public:
ResponseWriter(base::WeakPtr<InspectableWebContentsImpl> bindings, int stream_id); ResponseWriter(base::WeakPtr<InspectableWebContentsImpl> bindings,
int stream_id);
~ResponseWriter() override; ~ResponseWriter() override;
// URLFetcherResponseWriter overrides: // URLFetcherResponseWriter overrides:
@ -153,8 +154,9 @@ class ResponseWriter : public net::URLFetcherResponseWriter {
DISALLOW_COPY_AND_ASSIGN(ResponseWriter); DISALLOW_COPY_AND_ASSIGN(ResponseWriter);
}; };
ResponseWriter::ResponseWriter(base::WeakPtr<InspectableWebContentsImpl> bindings, ResponseWriter::ResponseWriter(
int stream_id) base::WeakPtr<InspectableWebContentsImpl> bindings,
int stream_id)
: bindings_(bindings), : bindings_(bindings),
stream_id_(stream_id) { stream_id_(stream_id) {
} }
@ -207,7 +209,8 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
delegate_(nullptr), delegate_(nullptr),
web_contents_(web_contents), web_contents_(web_contents),
weak_factory_(this) { weak_factory_(this) {
auto context = static_cast<BrowserContext*>(web_contents_->GetBrowserContext()); auto context =
static_cast<BrowserContext*>(web_contents_->GetBrowserContext());
pref_service_ = context->prefs(); pref_service_ = context->prefs();
auto bounds_dict = pref_service_->GetDictionary(kDevToolsBoundsPref); auto bounds_dict = pref_service_->GetDictionary(kDevToolsBoundsPref);
if (bounds_dict) { if (bounds_dict) {
@ -226,8 +229,10 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
display = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); display = display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
} }
devtools_bounds_.set_x(display.x() + (display.width() - devtools_bounds_.width()) / 2); devtools_bounds_.set_x(display.x() +
devtools_bounds_.set_y(display.y() + (display.height() - devtools_bounds_.height()) / 2); (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(); return web_contents_.get();
} }
content::WebContents* InspectableWebContentsImpl::GetDevToolsWebContents() const { content::WebContents* InspectableWebContentsImpl::GetDevToolsWebContents()
const {
return devtools_web_contents_.get(); return devtools_web_contents_.get();
} }
@ -255,11 +261,13 @@ void InspectableWebContentsImpl::InspectElement(int x, int y) {
agent_host_->InspectElement(this, x, y); agent_host_->InspectElement(this, x, y);
} }
void InspectableWebContentsImpl::SetDelegate(InspectableWebContentsDelegate* delegate) { void InspectableWebContentsImpl::SetDelegate(
InspectableWebContentsDelegate* delegate) {
delegate_ = delegate; delegate_ = delegate;
} }
InspectableWebContentsDelegate* InspectableWebContentsImpl::GetDelegate() const { InspectableWebContentsDelegate* InspectableWebContentsImpl::GetDelegate()
const {
return delegate_; return delegate_;
} }
@ -279,7 +287,8 @@ void InspectableWebContentsImpl::ShowDevTools() {
embedder_message_dispatcher_.reset( embedder_message_dispatcher_.reset(
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(this)); 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)); devtools_web_contents_.reset(content::WebContents::Create(create_params));
Observe(devtools_web_contents_.get()); Observe(devtools_web_contents_.get());
@ -324,10 +333,11 @@ void InspectableWebContentsImpl::Detach() {
agent_host_ = nullptr; agent_host_ = nullptr;
} }
void InspectableWebContentsImpl::CallClientFunction(const std::string& function_name, void InspectableWebContentsImpl::CallClientFunction(
const base::Value* arg1, const std::string& function_name,
const base::Value* arg2, const base::Value* arg1,
const base::Value* arg3) { const base::Value* arg2,
const base::Value* arg3) {
if (!devtools_web_contents_) if (!devtools_web_contents_)
return; return;
@ -433,15 +443,17 @@ void InspectableWebContentsImpl::LoadNetworkResource(
return; return;
} }
auto browser_context = static_cast<BrowserContext*>(devtools_web_contents_->GetBrowserContext()); auto browser_context =
static_cast<BrowserContext*>(devtools_web_contents_->GetBrowserContext());
net::URLFetcher* fetcher = net::URLFetcher* fetcher =
(net::URLFetcher::Create(gurl, net::URLFetcher::GET, this)).release(); (net::URLFetcher::Create(gurl, net::URLFetcher::GET, this)).release();
pending_requests_[fetcher] = callback; pending_requests_[fetcher] = callback;
fetcher->SetRequestContext(browser_context->url_request_context_getter()); fetcher->SetRequestContext(browser_context->url_request_context_getter());
fetcher->SetExtraRequestHeaders(headers); fetcher->SetExtraRequestHeaders(headers);
fetcher->SaveResponseWithWriter(std::unique_ptr<net::URLFetcherResponseWriter>( fetcher->SaveResponseWithWriter(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); std::unique_ptr<net::URLFetcherResponseWriter>(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
fetcher->Start(); fetcher->Start();
} }
@ -509,7 +521,8 @@ void InspectableWebContentsImpl::SearchInPath(
delegate_->DevToolsSearchInPath(request_id, file_system_path, query); 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() { void InspectableWebContentsImpl::ZoomIn() {
@ -548,16 +561,18 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
agent_host_->DispatchProtocolMessage(this, message); 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) if (name == kDevToolsActionTakenHistogram)
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary); UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary);
else if (name == kDevToolsPanelShownHistogram) else if (name == kDevToolsPanelShownHistogram)
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary); UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary);
} }
void InspectableWebContentsImpl::SendJsonRequest(const DispatchCallback& callback, void InspectableWebContentsImpl::SendJsonRequest(
const std::string& browser_id, const DispatchCallback& callback,
const std::string& url) { const std::string& browser_id,
const std::string& url) {
callback.Run(nullptr); callback.Run(nullptr);
} }
@ -584,7 +599,8 @@ void InspectableWebContentsImpl::ClearPreferences() {
update.Get()->Clear(); update.Get()->Clear();
} }
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::string& message) { void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(
const std::string& message) {
std::string method; std::string method;
base::ListValue empty_params; base::ListValue empty_params;
base::ListValue* params = &empty_params; base::ListValue* params = &empty_params;
@ -728,14 +744,14 @@ void InspectableWebContentsImpl::OnWebContentsFocused() {
void InspectableWebContentsImpl::DidStartNavigationToPendingEntry( void InspectableWebContentsImpl::DidStartNavigationToPendingEntry(
const GURL& url, const GURL& url,
content::ReloadType reload_type) { content::ReloadType reload_type) {
frontend_host_.reset( frontend_host_.reset(content::DevToolsFrontendHost::Create(
content::DevToolsFrontendHost::Create( web_contents()->GetMainFrame(),
web_contents()->GetMainFrame(), base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend,
base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, base::Unretained(this))));
base::Unretained(this))));
} }
void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) { void InspectableWebContentsImpl::OnURLFetchComplete(
const net::URLFetcher* source) {
DCHECK(source); DCHECK(source);
auto it = pending_requests_.find(source); auto it = pending_requests_.find(source);
DCHECK(it != pending_requests_.end()); DCHECK(it != pending_requests_.end());

View file

@ -173,7 +173,8 @@ class InspectableWebContentsImpl :
bool frontend_loaded_; bool frontend_loaded_;
scoped_refptr<content::DevToolsAgentHost> agent_host_; scoped_refptr<content::DevToolsAgentHost> agent_host_;
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_; std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
std::unique_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; std::unique_ptr<DevToolsEmbedderMessageDispatcher>
embedder_message_dispatcher_;
DevToolsContentsResizingStrategy contents_resizing_strategy_; DevToolsContentsResizingStrategy contents_resizing_strategy_;
gfx::Rect devtools_bounds_; gfx::Rect devtools_bounds_;

View file

@ -1,5 +1,6 @@
// This is generated file. Do not modify directly. // 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" #include "browser/linux/libnotify_loader.h"
@ -68,9 +69,9 @@ bool LibNotifyLoader::Load(const std::string& library_name) {
return false; return false;
} }
notify_notification_set_image_from_pixbuf = notify_notification_set_image_from_pixbuf = reinterpret_cast<decltype(
reinterpret_cast<decltype(this->notify_notification_set_image_from_pixbuf)>( this->notify_notification_set_image_from_pixbuf)>(
dlsym(library_, "notify_notification_set_image_from_pixbuf")); dlsym(library_, "notify_notification_set_image_from_pixbuf"));
if (!notify_notification_set_image_from_pixbuf) { if (!notify_notification_set_image_from_pixbuf) {
CleanUp(true); CleanUp(true);
return false; return false;

View file

@ -1,5 +1,6 @@
// This is generated file. Do not modify directly. // 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_ #ifndef BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_
#define 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_get_server_info) notify_get_server_info;
decltype(&::notify_notification_new) notify_notification_new; decltype(&::notify_notification_new) notify_notification_new;
decltype(&::notify_notification_add_action) notify_notification_add_action; 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_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_show) notify_notification_show;
decltype(&::notify_notification_close) notify_notification_close; decltype(&::notify_notification_close) notify_notification_close;

View file

@ -22,7 +22,8 @@ bool HasCapability(const std::string& capability) {
bool result = false; bool result = false;
GList* capabilities = libnotify_loader_.notify_get_server_caps(); 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; result = true;
g_list_free_full(capabilities, g_free); g_list_free_full(capabilities, g_free);

View file

@ -142,10 +142,12 @@ void MediaStreamDevicesController::Accept() {
content::MediaResponseCallback cb = callback_; content::MediaResponseCallback cb = callback_;
callback_.Reset(); callback_.Reset();
cb.Run(devices, content::MEDIA_DEVICE_OK, std::unique_ptr<content::MediaStreamUI>()); cb.Run(devices, content::MEDIA_DEVICE_OK,
std::unique_ptr<content::MediaStreamUI>());
} }
void MediaStreamDevicesController::Deny(content::MediaStreamRequestResult result) { void MediaStreamDevicesController::Deny(
content::MediaStreamRequestResult result) {
content::MediaResponseCallback cb = callback_; content::MediaResponseCallback cb = callback_;
callback_.Reset(); callback_.Reset();
cb.Run(content::MediaStreamDevices(), cb.Run(content::MediaStreamDevices(),

View file

@ -24,8 +24,9 @@ class DevToolsNetworkController {
DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id); DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id);
private: private:
using InterceptorMap = base::ScopedPtrHashMap<std::string, using InterceptorMap =
std::unique_ptr<DevToolsNetworkInterceptor>>; base::ScopedPtrHashMap<std::string,
std::unique_ptr<DevToolsNetworkInterceptor>>;
std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_; std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_;
InterceptorMap interceptors_; InterceptorMap interceptors_;

View file

@ -31,8 +31,9 @@ class DevToolsNetworkControllerHandle {
private: private:
void LazyInitialize(); void LazyInitialize();
void SetNetworkStateOnIO(const std::string& client_id, void SetNetworkStateOnIO(
std::unique_ptr<DevToolsNetworkConditions> conditions); const std::string& client_id,
std::unique_ptr<DevToolsNetworkConditions> conditions);
std::unique_ptr<DevToolsNetworkController> controller_; std::unique_ptr<DevToolsNetworkController> controller_;

View file

@ -30,7 +30,8 @@ const char kErrorMessage[] = "message";
} // namespace params } // namespace params
const char kEmulateNetworkConditions[] = "Network.emulateNetworkConditions"; const char kEmulateNetworkConditions[] = "Network.emulateNetworkConditions";
const char kCanEmulateNetworkConditions[] = "Network.canEmulateNetworkConditions"; const char kCanEmulateNetworkConditions[] =
"Network.canEmulateNetworkConditions";
const char kId[] = "id"; const char kId[] = "id";
const char kMethod[] = "method"; const char kMethod[] = "method";
const char kParams[] = "params"; const char kParams[] = "params";

View file

@ -21,13 +21,14 @@ class DevToolsNetworkTransactionFactory : public net::HttpTransactionFactory {
~DevToolsNetworkTransactionFactory() override; ~DevToolsNetworkTransactionFactory() override;
// net::HttpTransactionFactory: // net::HttpTransactionFactory:
int CreateTransaction(net::RequestPriority priority, int CreateTransaction(
std::unique_ptr<net::HttpTransaction>* transaction) override; net::RequestPriority priority,
std::unique_ptr<net::HttpTransaction>* transaction) override;
net::HttpCache* GetCache() override; net::HttpCache* GetCache() override;
net::HttpNetworkSession* GetSession() override; net::HttpNetworkSession* GetSession() override;
private: private:
DevToolsNetworkController* controller_; DevToolsNetworkController* controller_;
std::unique_ptr<net::HttpTransactionFactory> network_layer_; std::unique_ptr<net::HttpTransactionFactory> network_layer_;
DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransactionFactory); DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransactionFactory);

View file

@ -40,7 +40,8 @@ void NetLog::StartLogging(net::URLRequestContext* url_request_context) {
if (!command_line->HasSwitch(switches::kLogNetLog)) if (!command_line->HasSwitch(switches::kLogNetLog))
return; return;
base::FilePath log_path = command_line->GetSwitchValuePath(switches::kLogNetLog); base::FilePath log_path =
command_line->GetSwitchValuePath(switches::kLogNetLog);
#if defined(OS_WIN) #if defined(OS_WIN)
log_file_.reset(_wfopen(log_path.value().c_str(), L"w")); log_file_.reset(_wfopen(log_path.value().c_str(), L"w"));
#elif defined(OS_POSIX) #elif defined(OS_POSIX)

View file

@ -25,7 +25,8 @@ const char kIgnoreConnectionsLimit[] = "ignore-connections-limit";
NetworkDelegate::NetworkDelegate() { NetworkDelegate::NetworkDelegate() {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kIgnoreConnectionsLimit)) { 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( ignore_connections_limit_domains_ = base::SplitString(
value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
} }

View file

@ -22,14 +22,16 @@ class PermissionManager : public content::PermissionManager {
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin, const GURL& requesting_origin,
bool user_gesture, bool user_gesture,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback) override; const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
override;
int RequestPermissions( int RequestPermissions(
const std::vector<content::PermissionType>& permissions, const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin, const GURL& requesting_origin,
bool user_gesture, bool user_gesture,
const base::Callback<void( const base::Callback<
const std::vector<blink::mojom::PermissionStatus>&)>& callback) override; void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
override;
void CancelPermissionRequest(int request_id) override; void CancelPermissionRequest(int request_id) override;
void ResetPermission(content::PermissionType permission, void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,
@ -45,7 +47,8 @@ class PermissionManager : public content::PermissionManager {
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,
const GURL& embedding_origin, const GURL& embedding_origin,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback) override; const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
override;
void UnsubscribePermissionStatusChange(int subscription_id) override; void UnsubscribePermissionStatusChange(int subscription_id) override;
private: private:

View file

@ -45,7 +45,8 @@ PlatformNotificationService::PlatformNotificationService(
PlatformNotificationService::~PlatformNotificationService() {} PlatformNotificationService::~PlatformNotificationService() {}
blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnUIThread( blink::mojom::PermissionStatus
PlatformNotificationService::CheckPermissionOnUIThread(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
const GURL& origin, const GURL& origin,
int render_process_id) { int render_process_id) {
@ -53,7 +54,8 @@ blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnUIT
return blink::mojom::PermissionStatus::GRANTED; return blink::mojom::PermissionStatus::GRANTED;
} }
blink::mojom::PermissionStatus PlatformNotificationService::CheckPermissionOnIOThread( blink::mojom::PermissionStatus
PlatformNotificationService::CheckPermissionOnIOThread(
content::ResourceContext* resource_context, content::ResourceContext* resource_context,
const GURL& origin, const GURL& origin,
int render_process_id) { int render_process_id) {

View file

@ -69,7 +69,8 @@ std::string URLRequestContextGetter::Delegate::GetUserAgent() {
std::unique_ptr<net::URLRequestJobFactory> std::unique_ptr<net::URLRequestJobFactory>
URLRequestContextGetter::Delegate::CreateURLRequestJobFactory( URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers) { content::ProtocolHandlerMap* protocol_handlers) {
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(new net::URLRequestJobFactoryImpl); std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl);
for (auto& it : *protocol_handlers) { for (auto& it : *protocol_handlers) {
job_factory->SetProtocolHandler( job_factory->SetProtocolHandler(
@ -89,7 +90,8 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
} }
net::HttpCache::BackendFactory* 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")); base::FilePath cache_path = base_path.Append(FILE_PATH_LITERAL("Cache"));
return new net::HttpCache::DefaultBackend( return new net::HttpCache::DefaultBackend(
net::DISK_CACHE, net::DISK_CACHE,
@ -104,11 +106,13 @@ URLRequestContextGetter::Delegate::CreateCertVerifier() {
return net::CertVerifier::CreateDefault(); return net::CertVerifier::CreateDefault();
} }
net::SSLConfigService* URLRequestContextGetter::Delegate::CreateSSLConfigService() { net::SSLConfigService*
URLRequestContextGetter::Delegate::CreateSSLConfigService() {
return new net::SSLConfigServiceDefaults; return new net::SSLConfigServiceDefaults;
} }
std::vector<std::string> URLRequestContextGetter::Delegate::GetCookieableSchemes() { std::vector<std::string>
URLRequestContextGetter::Delegate::GetCookieableSchemes() {
return { "http", "https", "ws", "wss" }; return { "http", "https", "ws", "wss" };
} }
@ -177,7 +181,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
network_delegate_.reset(delegate_->CreateNetworkDelegate()); network_delegate_.reset(delegate_->CreateNetworkDelegate());
url_request_context_->set_network_delegate(network_delegate_.get()); 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_ ? auto cookie_path = in_memory_ ?
base::FilePath() : base_path_.Append(FILE_PATH_LITERAL("Cookies")); base::FilePath() : base_path_.Append(FILE_PATH_LITERAL("Cookies"));
@ -261,7 +266,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
// --auth-negotiate-delegate-whitelist // --auth-negotiate-delegate-whitelist
if (command_line.HasSwitch(switches::kAuthNegotiateDelegateWhitelist)) { if (command_line.HasSwitch(switches::kAuthNegotiateDelegateWhitelist)) {
http_auth_preferences_->set_delegate_whitelist( http_auth_preferences_->set_delegate_whitelist(
command_line.GetSwitchValueASCII(switches::kAuthNegotiateDelegateWhitelist)); command_line.GetSwitchValueASCII(
switches::kAuthNegotiateDelegateWhitelist));
} }
auto auth_handler_factory = 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|. // Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
storage_->set_host_resolver(std::move(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( http_network_session_.reset(
new net::HttpNetworkSession(network_session_params)); new net::HttpNetworkSession(network_session_params));
@ -324,7 +331,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
storage_->set_http_transaction_factory(base::WrapUnique( storage_->set_http_transaction_factory(base::WrapUnique(
new net::HttpCache( new net::HttpCache(
base::WrapUnique(new DevToolsNetworkTransactionFactory( base::WrapUnique(new DevToolsNetworkTransactionFactory(
network_controller_handle_->GetController(), http_network_session_.get())), network_controller_handle_->GetController(),
http_network_session_.get())),
std::move(backend), std::move(backend),
false))); false)));
} else { } else {
@ -356,7 +364,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
return url_request_context_.get(); return url_request_context_.get();
} }
scoped_refptr<base::SingleThreadTaskRunner> URLRequestContextGetter::GetNetworkTaskRunner() const { scoped_refptr<base::SingleThreadTaskRunner>
URLRequestContextGetter::GetNetworkTaskRunner() const {
return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
} }

View file

@ -47,8 +47,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
} }
virtual std::string GetUserAgent(); virtual std::string GetUserAgent();
virtual std::unique_ptr<net::URLRequestJobFactory> virtual std::unique_ptr<net::URLRequestJobFactory>
CreateURLRequestJobFactory( CreateURLRequestJobFactory(content::ProtocolHandlerMap* protocol_handlers);
content::ProtocolHandlerMap* protocol_handlers);
virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory( virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path); const base::FilePath& base_path);
virtual std::unique_ptr<net::CertVerifier> CreateCertVerifier(); virtual std::unique_ptr<net::CertVerifier> CreateCertVerifier();
@ -75,7 +74,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
// net::URLRequestContextGetter: // net::URLRequestContextGetter:
net::URLRequestContext* GetURLRequestContext() override; net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override; scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
const override;
net::HostResolver* host_resolver(); net::HostResolver* host_resolver();
net::URLRequestJobFactory* job_factory() const { return job_factory_; } net::URLRequestJobFactory* job_factory() const { return job_factory_; }

View file

@ -48,7 +48,9 @@ class DevToolsWindowDelegate : public views::ClientView,
views::Widget* GetWidget() override { return widget_; } views::Widget* GetWidget() override { return widget_; }
const views::Widget* GetWidget() const override { return widget_; } const views::Widget* GetWidget() const override { return widget_; }
views::View* GetContentsView() override { return view_; } 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: // views::ClientView:
bool CanClose() override { bool CanClose() override {
@ -85,10 +87,12 @@ InspectableWebContentsViewViews::InspectableWebContentsViewViews(
if (inspectable_web_contents_->GetWebContents()->GetNativeView()) { if (inspectable_web_contents_->GetWebContents()->GetNativeView()) {
views::WebView* contents_web_view = new views::WebView(nullptr); 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; contents_web_view_ = contents_web_view;
} else { } 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); devtools_web_view_->SetVisible(false);
@ -98,7 +102,8 @@ InspectableWebContentsViewViews::InspectableWebContentsViewViews(
InspectableWebContentsViewViews::~InspectableWebContentsViewViews() { InspectableWebContentsViewViews::~InspectableWebContentsViewViews() {
if (devtools_window_) if (devtools_window_)
inspectable_web_contents()->SaveDevToolsBounds(devtools_window_->GetWindowBoundsInScreen()); inspectable_web_contents()->SaveDevToolsBounds(
devtools_window_->GetWindowBoundsInScreen());
} }
views::View* InspectableWebContentsViewViews::GetView() { views::View* InspectableWebContentsViewViews::GetView() {
@ -117,7 +122,8 @@ void InspectableWebContentsViewViews::ShowDevTools() {
if (devtools_window_) { if (devtools_window_) {
devtools_window_web_view_->SetWebContents( devtools_window_web_view_->SetWebContents(
inspectable_web_contents_->GetDevToolsWebContents()); inspectable_web_contents_->GetDevToolsWebContents());
devtools_window_->SetBounds(inspectable_web_contents()->GetDevToolsBounds()); devtools_window_->SetBounds(
inspectable_web_contents()->GetDevToolsBounds());
devtools_window_->Show(); devtools_window_->Show();
} else { } else {
devtools_web_view_->SetVisible(true); devtools_web_view_->SetVisible(true);
@ -134,7 +140,8 @@ void InspectableWebContentsViewViews::CloseDevTools() {
devtools_visible_ = false; devtools_visible_ = false;
if (devtools_window_) { if (devtools_window_) {
inspectable_web_contents()->SaveDevToolsBounds(devtools_window_->GetWindowBoundsInScreen()); inspectable_web_contents()->SaveDevToolsBounds(
devtools_window_->GetWindowBoundsInScreen());
devtools_window_.reset(); devtools_window_.reset();
devtools_window_web_view_ = nullptr; devtools_window_web_view_ = nullptr;
devtools_window_delegate_ = nullptr; devtools_window_delegate_ = nullptr;
@ -164,9 +171,10 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) {
if (!docked) { if (!docked) {
devtools_window_.reset(new views::Widget); devtools_window_.reset(new views::Widget);
devtools_window_web_view_ = new views::WebView(NULL); devtools_window_web_view_ = new views::WebView(NULL);
devtools_window_delegate_ = new DevToolsWindowDelegate(this, devtools_window_delegate_ = new DevToolsWindowDelegate(
devtools_window_web_view_, this,
devtools_window_.get()); devtools_window_web_view_
devtools_window_.get());
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;
@ -176,7 +184,8 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) {
#if defined(USE_X11) #if defined(USE_X11)
params.wm_role_name = "devtools"; params.wm_role_name = "devtools";
if (GetDelegate()) if (GetDelegate())
GetDelegate()->GetDevToolsWindowWMClass(&params.wm_class_name, &params.wm_class_class); GetDelegate()->GetDevToolsWindowWMClass(&params.wm_class_name,
&params.wm_class_class);
#endif #endif
devtools_window_->Init(params); devtools_window_->Init(params);

View file

@ -48,7 +48,8 @@ void ViewsDelegate::NotifyMenuItemFocused(
#if defined(OS_WIN) #if defined(OS_WIN)
HICON ViewsDelegate::GetDefaultWindowIcon() const { HICON ViewsDelegate::GetDefaultWindowIcon() const {
// Use current exe's icon as default window icon. // 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 { HICON ViewsDelegate::GetSmallWindowIcon() const {

View file

@ -38,7 +38,8 @@ bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
NotificationPresenter* NotificationPresenter::Create() { NotificationPresenter* NotificationPresenter::Create() {
if (!WindowsToastNotification::Initialize()) if (!WindowsToastNotification::Initialize())
return nullptr; return nullptr;
std::unique_ptr<NotificationPresenterWin> presenter(new NotificationPresenterWin); std::unique_ptr<NotificationPresenterWin> presenter(
new NotificationPresenterWin);
if (!presenter->Init()) if (!presenter->Init())
return nullptr; return nullptr;
return presenter.release(); return presenter.release();

View file

@ -10,9 +10,15 @@
// icon: "file:///C:/Path/To/Your/Image.png" // icon: "file:///C:/Path/To/Your/Image.png"
// }); // });
// windowsNotification.onshow = function () { console.log("Notification shown") }; // windowsNotification.onshow = function () {
// windowsNotification.onclick = function () { console.log("Notification clicked") }; // console.log("Notification shown")
// windowsNotification.onclose = function () { console.log("Notification dismissed") }; // };
// windowsNotification.onclick = function () {
// console.log("Notification clicked")
// };
// windowsNotification.onclose = function () {
// console.log("Notification dismissed")
// };
#ifndef BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ #ifndef BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_
#define BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ #define BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_

View file

@ -61,9 +61,9 @@ void InitializeResourceBundle(const std::string& locale) {
bundle.AddDataPackFromPath( bundle.AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("pdf_viewer_resources.pak")), pak_dir.Append(FILE_PATH_LITERAL("pdf_viewer_resources.pak")),
ui::GetSupportedScaleFactors()[0]); ui::GetSupportedScaleFactors()[0]);
bundle.AddDataPackFromPath( bundle.AddDataPackFromPath(pak_dir.Append(FILE_PATH_LITERAL(
pak_dir.Append(FILE_PATH_LITERAL("blink_image_resources_200_percent.pak")), "blink_image_resources_200_percent.pak")),
ui::SCALE_FACTOR_200P); ui::SCALE_FACTOR_200P);
bundle.AddDataPackFromPath( bundle.AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("content_resources_200_percent.pak")), pak_dir.Append(FILE_PATH_LITERAL("content_resources_200_percent.pak")),
ui::SCALE_FACTOR_200P); ui::SCALE_FACTOR_200P);
@ -76,7 +76,6 @@ void InitializeResourceBundle(const std::string& locale) {
#endif #endif
} }
MainDelegate::MainDelegate() { MainDelegate::MainDelegate() {
} }

View file

@ -47,7 +47,8 @@ const char kDisableHttp2[] = "disable-http2";
const char kAuthServerWhitelist[] = "auth-server-whitelist"; const char kAuthServerWhitelist[] = "auth-server-whitelist";
// Whitelist containing servers for which Kerberos delegation is allowed. // 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. // Ignores certificate-related errors.
const char kIgnoreCertificateErrors[] = "ignore-certificate-errors"; const char kIgnoreCertificateErrors[] = "ignore-certificate-errors";