commit
ad81698651
16 changed files with 189 additions and 215 deletions
|
@ -48,8 +48,6 @@
|
|||
'browser/devtools_embedder_message_dispatcher.h',
|
||||
'browser/devtools_ui.cc',
|
||||
'browser/devtools_ui.h',
|
||||
'browser/download_manager_delegate.cc',
|
||||
'browser/download_manager_delegate.h',
|
||||
'browser/inspectable_web_contents.cc',
|
||||
'browser/inspectable_web_contents.h',
|
||||
'browser/inspectable_web_contents_delegate.cc',
|
||||
|
|
|
@ -275,7 +275,9 @@
|
|||
4355, # 'this' : used in base member initializer list
|
||||
4480, # nonstandard extension used: specifying underlying type for enum
|
||||
4481, # nonstandard extension used: override specifier 'override'
|
||||
4510, # default constructor could not be generated
|
||||
4512, # assignment operator could not be generated
|
||||
4610, # user defined constructor required
|
||||
4702, # unreachable code
|
||||
4819, # The file contains a character that cannot be represented in the current code page
|
||||
],
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "browser/browser_context.h"
|
||||
|
||||
#include "browser/download_manager_delegate.h"
|
||||
#include "browser/inspectable_web_contents_impl.h"
|
||||
#include "browser/network_delegate.h"
|
||||
#include "common/application_info.h"
|
||||
|
@ -45,18 +44,6 @@ class BrowserContext::ResourceContext : public content::ResourceContext {
|
|||
return getter_->GetURLRequestContext();
|
||||
}
|
||||
|
||||
// FIXME: We should probably allow clients to override this to implement more
|
||||
// restrictive policies.
|
||||
virtual bool AllowMicAccess(const GURL& origin) override {
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: We should probably allow clients to override this to implement more
|
||||
// restrictive policies.
|
||||
virtual bool AllowCameraAccess(const GURL& origin) override {
|
||||
return true;
|
||||
}
|
||||
|
||||
URLRequestContextGetter* getter_;
|
||||
};
|
||||
|
||||
|
@ -80,13 +67,13 @@ void BrowserContext::Initialize() {
|
|||
base::PrefServiceFactory prefs_factory;
|
||||
prefs_factory.SetUserPrefsFile(prefs_path,
|
||||
JsonPrefStore::GetTaskRunnerForFile(
|
||||
prefs_path, BrowserThread::GetBlockingPool()));
|
||||
prefs_path, BrowserThread::GetBlockingPool()).get());
|
||||
|
||||
auto registry = make_scoped_refptr(new PrefRegistrySimple);
|
||||
RegisterInternalPrefs(registry);
|
||||
RegisterPrefs(registry);
|
||||
RegisterInternalPrefs(registry.get());
|
||||
RegisterPrefs(registry.get());
|
||||
|
||||
prefs_ = prefs_factory.Create(registry);
|
||||
prefs_ = prefs_factory.Create(registry.get());
|
||||
}
|
||||
|
||||
BrowserContext::~BrowserContext() {
|
||||
|
@ -102,7 +89,7 @@ void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) {
|
|||
net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector protocol_interceptors) {
|
||||
DCHECK(!url_request_getter_);
|
||||
DCHECK(!url_request_getter_.get());
|
||||
url_request_getter_ = new URLRequestContextGetter(
|
||||
this,
|
||||
GetPath(),
|
||||
|
@ -157,21 +144,19 @@ content::ResourceContext* BrowserContext::GetResourceContext() {
|
|||
}
|
||||
|
||||
content::DownloadManagerDelegate* BrowserContext::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_)
|
||||
download_manager_delegate_.reset(new DownloadManagerDelegate);
|
||||
return download_manager_delegate_.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
quota::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() {
|
||||
return NULL;
|
||||
storage::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::PushMessagingService* BrowserContext::GetPushMessagingService() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate* BrowserContext::GetSSLHostStateDelegate() {
|
||||
|
|
|
@ -14,8 +14,6 @@ class PrefService;
|
|||
|
||||
namespace brightray {
|
||||
|
||||
class DownloadManagerDelegate;
|
||||
|
||||
class BrowserContext : public content::BrowserContext,
|
||||
public brightray::URLRequestContextGetter::Delegate {
|
||||
public:
|
||||
|
@ -48,28 +46,26 @@ class BrowserContext : public content::BrowserContext,
|
|||
|
||||
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
|
||||
|
||||
virtual bool IsOffTheRecord() const override;
|
||||
virtual net::URLRequestContextGetter* GetRequestContext() override;
|
||||
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
||||
bool IsOffTheRecord() const override;
|
||||
net::URLRequestContextGetter* GetRequestContext() override;
|
||||
net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
||||
int renderer_child_id);
|
||||
virtual net::URLRequestContextGetter* GetMediaRequestContext() override;
|
||||
virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
|
||||
net::URLRequestContextGetter* GetMediaRequestContext() override;
|
||||
net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
|
||||
int renderer_child_id) override;
|
||||
virtual net::URLRequestContextGetter*
|
||||
GetMediaRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path, bool in_memory);
|
||||
virtual content::ResourceContext* GetResourceContext() override;
|
||||
virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
virtual content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
virtual content::PushMessagingService* GetPushMessagingService() override;
|
||||
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path, bool in_memory) override;
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
|
||||
base::FilePath path_;
|
||||
scoped_ptr<ResourceContext> resource_context_;
|
||||
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
||||
scoped_ptr<PrefService> prefs_;
|
||||
scoped_ptr<DownloadManagerDelegate> download_manager_delegate_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
|
||||
};
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "browser/browser_context.h"
|
||||
#include "browser/inspectable_web_contents.h"
|
||||
#include "browser/default_web_contents_delegate.h"
|
||||
#include "browser/inspectable_web_contents_delegate.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/devtools_http_handler.h"
|
||||
#include "content/public/browser/devtools_target.h"
|
||||
|
@ -25,7 +22,7 @@
|
|||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "net/socket/tcp_listen_socket.h"
|
||||
#include "net/socket/tcp_server_socket.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
using content::DevToolsAgentHost;
|
||||
|
@ -43,8 +40,28 @@ namespace {
|
|||
const int kIDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE = 25500;
|
||||
|
||||
const char kTargetTypePage[] = "page";
|
||||
const char kTargetTypeServiceWorker[] = "service_worker";
|
||||
const char kTargetTypeOther[] = "other";
|
||||
|
||||
net::StreamListenSocketFactory* CreateSocketFactory() {
|
||||
class TCPServerSocketFactory
|
||||
: public content::DevToolsHttpHandler::ServerSocketFactory {
|
||||
public:
|
||||
TCPServerSocketFactory(const std::string& address, int port, int backlog)
|
||||
: content::DevToolsHttpHandler::ServerSocketFactory(
|
||||
address, port, backlog) {}
|
||||
|
||||
private:
|
||||
// content::DevToolsHttpHandler::ServerSocketFactory.
|
||||
scoped_ptr<net::ServerSocket> Create() const override {
|
||||
return scoped_ptr<net::ServerSocket>(
|
||||
new net::TCPServerSocket(NULL, net::NetLog::Source()));
|
||||
}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
|
||||
};
|
||||
|
||||
scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>
|
||||
CreateSocketFactory() {
|
||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||
// See if the user specified a port on the command line (useful for
|
||||
// automation). If not, use an ephemeral port by specifying 0.
|
||||
|
@ -60,75 +77,77 @@ net::StreamListenSocketFactory* CreateSocketFactory() {
|
|||
DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
|
||||
}
|
||||
}
|
||||
return new net::TCPListenSocketFactory("127.0.0.1", port);
|
||||
return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>(
|
||||
new TCPServerSocketFactory("127.0.0.1", port, 1));
|
||||
}
|
||||
|
||||
class Target : public content::DevToolsTarget {
|
||||
public:
|
||||
explicit Target(WebContents* web_contents);
|
||||
explicit Target(scoped_refptr<DevToolsAgentHost> agent_host);
|
||||
|
||||
virtual std::string GetId() const override { return id_; }
|
||||
virtual std::string GetParentId() const { return std::string(); }
|
||||
virtual std::string GetType() const override { return kTargetTypePage; }
|
||||
virtual std::string GetTitle() const override { return title_; }
|
||||
virtual std::string GetDescription() const override { return std::string(); }
|
||||
virtual GURL GetURL() const override { return url_; }
|
||||
virtual GURL GetFaviconURL() const override { return favicon_url_; }
|
||||
virtual base::TimeTicks GetLastActivityTime() const override {
|
||||
virtual std::string GetId() const OVERRIDE { return agent_host_->GetId(); }
|
||||
virtual std::string GetParentId() const OVERRIDE { return std::string(); }
|
||||
virtual std::string GetType() const OVERRIDE {
|
||||
switch (agent_host_->GetType()) {
|
||||
case DevToolsAgentHost::TYPE_WEB_CONTENTS:
|
||||
return kTargetTypePage;
|
||||
case DevToolsAgentHost::TYPE_SERVICE_WORKER:
|
||||
return kTargetTypeServiceWorker;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return kTargetTypeOther;
|
||||
}
|
||||
virtual std::string GetTitle() const OVERRIDE {
|
||||
return agent_host_->GetTitle();
|
||||
}
|
||||
virtual std::string GetDescription() const OVERRIDE { return std::string(); }
|
||||
virtual GURL GetURL() const OVERRIDE { return agent_host_->GetURL(); }
|
||||
virtual GURL GetFaviconURL() const OVERRIDE { return favicon_url_; }
|
||||
virtual base::TimeTicks GetLastActivityTime() const OVERRIDE {
|
||||
return last_activity_time_;
|
||||
}
|
||||
virtual bool IsAttached() const override {
|
||||
virtual bool IsAttached() const OVERRIDE {
|
||||
return agent_host_->IsAttached();
|
||||
}
|
||||
virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const override {
|
||||
virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const OVERRIDE {
|
||||
return agent_host_;
|
||||
}
|
||||
virtual bool Activate() const override;
|
||||
virtual bool Close() const override;
|
||||
virtual bool Activate() const OVERRIDE;
|
||||
virtual bool Close() const OVERRIDE;
|
||||
|
||||
private:
|
||||
scoped_refptr<DevToolsAgentHost> agent_host_;
|
||||
std::string id_;
|
||||
std::string title_;
|
||||
GURL url_;
|
||||
GURL favicon_url_;
|
||||
base::TimeTicks last_activity_time_;
|
||||
};
|
||||
|
||||
Target::Target(WebContents* web_contents) {
|
||||
agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents);
|
||||
id_ = agent_host_->GetId();
|
||||
title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
||||
url_ = web_contents->GetURL();
|
||||
content::NavigationController& controller = web_contents->GetController();
|
||||
content::NavigationEntry* entry = controller.GetActiveEntry();
|
||||
if (entry != NULL && entry->GetURL().is_valid())
|
||||
favicon_url_ = entry->GetFavicon().url;
|
||||
last_activity_time_ = web_contents->GetLastActiveTime();
|
||||
Target::Target(scoped_refptr<DevToolsAgentHost> agent_host)
|
||||
: agent_host_(agent_host) {
|
||||
if (WebContents* web_contents = agent_host_->GetWebContents()) {
|
||||
content::NavigationController& controller = web_contents->GetController();
|
||||
content::NavigationEntry* entry = controller.GetActiveEntry();
|
||||
if (entry != NULL && entry->GetURL().is_valid())
|
||||
favicon_url_ = entry->GetFavicon().url;
|
||||
last_activity_time_ = web_contents->GetLastActiveTime();
|
||||
}
|
||||
}
|
||||
|
||||
bool Target::Activate() const {
|
||||
WebContents* web_contents = agent_host_->GetWebContents();
|
||||
if (!web_contents)
|
||||
return false;
|
||||
web_contents->GetDelegate()->ActivateContents(web_contents);
|
||||
return true;
|
||||
return agent_host_->Activate();
|
||||
}
|
||||
|
||||
bool Target::Close() const {
|
||||
WebContents* web_contents = agent_host_->GetWebContents();
|
||||
if (!web_contents)
|
||||
return false;
|
||||
web_contents->GetRenderViewHost()->ClosePage();
|
||||
return true;
|
||||
return agent_host_->Close();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace brightray {
|
||||
|
||||
DevToolsDelegate::DevToolsDelegate(
|
||||
content::BrowserContext* browser_context)
|
||||
// DevToolsDelegate --------------------------------------------------------
|
||||
|
||||
DevToolsDelegate::DevToolsDelegate(content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {
|
||||
std::string frontend_url;
|
||||
devtools_http_handler_ = DevToolsHttpHandler::Start(
|
||||
|
@ -156,32 +175,6 @@ base::FilePath DevToolsDelegate::GetDebugFrontendDir() {
|
|||
return base::FilePath();
|
||||
}
|
||||
|
||||
std::string DevToolsDelegate::GetPageThumbnailData(const GURL& url) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
scoped_ptr<DevToolsTarget>
|
||||
DevToolsDelegate::CreateNewTarget(const GURL& url) {
|
||||
content::WebContents::CreateParams create_params(
|
||||
new brightray::BrowserContext());
|
||||
brightray::InspectableWebContents* web_contents =
|
||||
brightray::InspectableWebContents::Create(create_params);
|
||||
web_contents->SetDelegate(new brightray::InspectableWebContentsDelegate());
|
||||
return scoped_ptr<DevToolsTarget>(new Target(web_contents->GetWebContents()));
|
||||
}
|
||||
|
||||
void DevToolsDelegate::EnumerateTargets(TargetCallback callback) {
|
||||
TargetList targets;
|
||||
std::vector<WebContents*> wc_list =
|
||||
content::DevToolsAgentHost::GetInspectableWebContents();
|
||||
for (std::vector<WebContents*>::iterator it = wc_list.begin();
|
||||
it != wc_list.end();
|
||||
++it) {
|
||||
targets.push_back(new Target(*it));
|
||||
}
|
||||
callback.Run(targets);
|
||||
}
|
||||
|
||||
scoped_ptr<net::StreamListenSocket>
|
||||
DevToolsDelegate::CreateSocketForTethering(
|
||||
net::StreamListenSocket::Delegate* delegate,
|
||||
|
@ -189,4 +182,41 @@ DevToolsDelegate::CreateSocketForTethering(
|
|||
return scoped_ptr<net::StreamListenSocket>();
|
||||
}
|
||||
|
||||
// DevToolsManagerDelegate ---------------------------------------------------
|
||||
|
||||
DevToolsManagerDelegate::DevToolsManagerDelegate(
|
||||
content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {
|
||||
}
|
||||
|
||||
DevToolsManagerDelegate::~DevToolsManagerDelegate() {
|
||||
}
|
||||
|
||||
base::DictionaryValue* DevToolsManagerDelegate::HandleCommand(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
base::DictionaryValue* command) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string DevToolsManagerDelegate::GetPageThumbnailData(
|
||||
const GURL& url) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
scoped_ptr<content::DevToolsTarget>
|
||||
DevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
|
||||
return scoped_ptr<content::DevToolsTarget>();
|
||||
}
|
||||
|
||||
void DevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) {
|
||||
TargetList targets;
|
||||
content::DevToolsAgentHost::List agents =
|
||||
content::DevToolsAgentHost::GetOrCreateAll();
|
||||
for (content::DevToolsAgentHost::List::iterator it = agents.begin();
|
||||
it != agents.end(); ++it) {
|
||||
targets.push_back(new Target(*it));
|
||||
}
|
||||
callback.Run(targets);
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
#ifndef BRIGHTRAY_DEVTOOLS_DELEGATE_H_
|
||||
#define BRIGHTRAY_DEVTOOLS_DELEGATE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "content/public/browser/devtools_http_handler_delegate.h"
|
||||
#include "content/public/browser/devtools_manager_delegate.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
|
@ -27,14 +26,10 @@ class DevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
|||
void Stop();
|
||||
|
||||
// DevToolsHttpProtocolHandler::Delegate overrides.
|
||||
virtual std::string GetDiscoveryPageHTML() override;
|
||||
virtual bool BundlesFrontendResources() override;
|
||||
virtual base::FilePath GetDebugFrontendDir() override;
|
||||
virtual std::string GetPageThumbnailData(const GURL& url) override;
|
||||
virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget(
|
||||
const GURL& url) override;
|
||||
virtual void EnumerateTargets(TargetCallback callback) override;
|
||||
virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
|
||||
std::string GetDiscoveryPageHTML() override;
|
||||
bool BundlesFrontendResources() override;
|
||||
base::FilePath GetDebugFrontendDir() override;
|
||||
scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
|
||||
net::StreamListenSocket::Delegate* delegate,
|
||||
std::string* name) override;
|
||||
|
||||
|
@ -49,6 +44,30 @@ class DevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
|||
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
|
||||
};
|
||||
|
||||
class DevToolsManagerDelegate : public content::DevToolsManagerDelegate {
|
||||
public:
|
||||
explicit DevToolsManagerDelegate(content::BrowserContext* browser_context);
|
||||
virtual ~DevToolsManagerDelegate();
|
||||
|
||||
// DevToolsManagerDelegate implementation.
|
||||
void Inspect(content::BrowserContext* browser_context,
|
||||
content::DevToolsAgentHost* agent_host) override {}
|
||||
void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host,
|
||||
bool attached) override {}
|
||||
base::DictionaryValue* HandleCommand(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
base::DictionaryValue* command) override;
|
||||
scoped_ptr<content::DevToolsTarget> CreateNewTarget(
|
||||
const GURL& url) override;
|
||||
void EnumerateTargets(TargetCallback callback) override;
|
||||
std::string GetPageThumbnailData(const GURL& url) override;
|
||||
|
||||
private:
|
||||
content::BrowserContext* browser_context_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DevToolsManagerDelegate);
|
||||
};
|
||||
|
||||
} // namespace brightray
|
||||
|
||||
#endif // BRIGHTRAY_DEVTOOLS_DELEGATE_H_
|
||||
|
|
|
@ -68,13 +68,14 @@ class BundledDataSource : public content::URLDataSource {
|
|||
int resource_id =
|
||||
content::DevToolsHttpHandler::GetFrontendResourceId(filename);
|
||||
|
||||
DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: "
|
||||
<< filename << ". If you compiled with debug_devtools=1, try running"
|
||||
" with --debug-devtools.";
|
||||
DLOG_IF(WARNING, resource_id == -1)
|
||||
<< "Unable to find dev tool resource: " << filename
|
||||
<< ". If you compiled with debug_devtools=1, try running with "
|
||||
"--debug-devtools.";
|
||||
const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
||||
scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(
|
||||
resource_id));
|
||||
callback.Run(bytes);
|
||||
callback.Run(bytes.get());
|
||||
}
|
||||
|
||||
virtual std::string GetMimeType(const std::string& path) const override {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#include "browser/download_manager_delegate.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
DownloadManagerDelegate::DownloadManagerDelegate() {
|
||||
}
|
||||
|
||||
DownloadManagerDelegate::~DownloadManagerDelegate() {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef BRIGHTRAY_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
|
||||
#define BRIGHTRAY_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
|
||||
|
||||
#include "content/public/browser/download_manager_delegate.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
class DownloadManagerDelegate : public content::DownloadManagerDelegate {
|
||||
public:
|
||||
DownloadManagerDelegate();
|
||||
~DownloadManagerDelegate();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate);
|
||||
};
|
||||
|
||||
} // namespace brightray
|
||||
|
||||
#endif
|
|
@ -17,10 +17,7 @@
|
|||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/devtools_client_host.h"
|
||||
#include "content/public/browser/devtools_http_handler.h"
|
||||
#include "content/public/browser/devtools_manager.h"
|
||||
#include "content/public/browser/host_zoom_map.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
|
@ -33,8 +30,6 @@ const double kPresetZoomFactors[] = { 0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1.0,
|
|||
1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0,
|
||||
5.0 };
|
||||
|
||||
const char kDevToolsScheme[] = "chrome-devtools";
|
||||
const char kDevToolsHost[] = "devtools";
|
||||
const char kChromeUIDevToolsURL[] = "chrome-devtools://devtools/devtools.html?"
|
||||
"can_dock=%s&"
|
||||
"toolbarColor=rgba(223,223,223,1)&"
|
||||
|
@ -91,15 +86,11 @@ bool ParseMessage(const std::string& message,
|
|||
}
|
||||
|
||||
double GetZoomLevelForWebContents(content::WebContents* web_contents) {
|
||||
content::HostZoomMap* host_zoom_map = content::HostZoomMap::GetForBrowserContext(
|
||||
web_contents->GetBrowserContext());
|
||||
return host_zoom_map->GetZoomLevelForHostAndScheme(kDevToolsScheme, kDevToolsHost);
|
||||
return content::HostZoomMap::GetZoomLevel(web_contents);
|
||||
}
|
||||
|
||||
void SetZoomLevelForWebContents(content::WebContents* web_contents, double level) {
|
||||
content::HostZoomMap* host_zoom_map = content::HostZoomMap::GetForBrowserContext(
|
||||
web_contents->GetBrowserContext());
|
||||
return host_zoom_map->SetZoomLevelForHostAndScheme(kDevToolsScheme, kDevToolsHost, level);
|
||||
content::HostZoomMap::SetZoomLevel(web_contents, level);
|
||||
}
|
||||
|
||||
double GetNextZoomLevel(double level, bool out) {
|
||||
|
@ -172,13 +163,13 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
|||
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get());
|
||||
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
||||
web_contents_->GetRenderViewHost(), this));
|
||||
content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(agent_host_, this);
|
||||
agent_host_->AttachClient(this);
|
||||
|
||||
GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, can_dock_ ? "true" : ""));
|
||||
devtools_web_contents_->GetController().LoadURL(
|
||||
devtools_url,
|
||||
content::Referrer(),
|
||||
content::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
||||
ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
||||
std::string());
|
||||
} else {
|
||||
view_->ShowDevTools();
|
||||
|
@ -312,21 +303,18 @@ void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::st
|
|||
|
||||
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend(
|
||||
const std::string& message) {
|
||||
content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend(
|
||||
this, message);
|
||||
agent_host_->DispatchProtocolMessage(message);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::DispatchOnInspectorFrontend(
|
||||
const std::string& message) {
|
||||
void InspectableWebContentsImpl::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host, const std::string& message) {
|
||||
std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::InspectedContentsClosing() {
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::ReplacedWithAnotherClient() {
|
||||
void InspectableWebContentsImpl::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host, bool replaced) {
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::AboutToNavigateRenderView(
|
||||
|
@ -348,7 +336,7 @@ void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_
|
|||
}
|
||||
|
||||
void InspectableWebContentsImpl::WebContentsDestroyed() {
|
||||
content::DevToolsManager::GetInstance()->ClientHostClosing(this);
|
||||
agent_host_->DetachClient();
|
||||
Observe(nullptr);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "browser/devtools_contents_resizing_strategy.h"
|
||||
#include "browser/devtools_embedder_message_dispatcher.h"
|
||||
|
||||
#include "content/public/browser/devtools_client_host.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/devtools_frontend_host.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
@ -31,7 +31,7 @@ class InspectableWebContentsView;
|
|||
class InspectableWebContentsImpl :
|
||||
public InspectableWebContents,
|
||||
public content::DevToolsFrontendHost::Delegate,
|
||||
public content::DevToolsClientHost,
|
||||
public content::DevToolsAgentHostClient,
|
||||
public content::WebContentsObserver,
|
||||
public content::WebContentsDelegate,
|
||||
public DevToolsEmbedderMessageDispatcher::Delegate {
|
||||
|
@ -93,15 +93,16 @@ class InspectableWebContentsImpl :
|
|||
void ZoomOut() override;
|
||||
void ResetZoom() override;
|
||||
|
||||
// content::DevToolsClientHost:
|
||||
void DispatchOnInspectorFrontend(const std::string& message) override;
|
||||
void InspectedContentsClosing() override;
|
||||
void ReplacedWithAnotherClient() override;
|
||||
|
||||
// content::DevToolsFrontendHostDelegate:
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message) override;
|
||||
void HandleMessageFromDevToolsFrontendToBackend(const std::string& message) override;
|
||||
|
||||
// content::DevToolsAgentHostClient:
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) override;
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) override;
|
||||
|
||||
// content::WebContentsObserver:
|
||||
void AboutToNavigateRenderView(content::RenderViewHost* render_view_host) override;
|
||||
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||
|
|
|
@ -21,8 +21,6 @@ using namespace brightray;
|
|||
devtools_docked_ = NO;
|
||||
|
||||
auto contents = inspectableWebContentsView_->inspectable_web_contents()->GetWebContents();
|
||||
contents->SetAllowOverlappingViews(true);
|
||||
|
||||
auto contentsView = contents->GetNativeView();
|
||||
[contentsView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
[self addSubview:contentsView];
|
||||
|
@ -45,9 +43,17 @@ using namespace brightray;
|
|||
if (visible == devtools_visible_)
|
||||
return;
|
||||
|
||||
auto webContents = inspectableWebContentsView_->inspectable_web_contents()->GetWebContents();
|
||||
auto devToolsWebContents = inspectableWebContentsView_->inspectable_web_contents()->devtools_web_contents();
|
||||
auto devToolsView = devToolsWebContents->GetNativeView();
|
||||
|
||||
if (visible && devtools_docked_) {
|
||||
webContents->SetAllowOtherViews(true);
|
||||
devToolsWebContents->SetAllowOtherViews(true);
|
||||
} else {
|
||||
webContents->SetAllowOtherViews(false);
|
||||
}
|
||||
|
||||
devtools_visible_ = visible;
|
||||
if (devtools_docked_) {
|
||||
if (visible) {
|
||||
|
|
|
@ -142,19 +142,6 @@ void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
|||
content::MediaRequestState state) {
|
||||
}
|
||||
|
||||
void MediaCaptureDevicesDispatcher::OnAudioStreamPlaying(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int stream_id,
|
||||
const ReadPowerAndClipCallback& power_read_callback) {
|
||||
}
|
||||
|
||||
void MediaCaptureDevicesDispatcher::OnAudioStreamStopped(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int stream_id) {
|
||||
}
|
||||
|
||||
void MediaCaptureDevicesDispatcher::OnCreatingAudioStream(
|
||||
int render_process_id,
|
||||
int render_view_id) {
|
||||
|
|
|
@ -60,15 +60,6 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
|||
const GURL& security_origin,
|
||||
content::MediaStreamType stream_type,
|
||||
content::MediaRequestState state) override;
|
||||
virtual void OnAudioStreamPlaying(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int stream_id,
|
||||
const ReadPowerAndClipCallback& power_read_callback) override;
|
||||
virtual void OnAudioStreamStopped(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
int stream_id) override;
|
||||
virtual void OnCreatingAudioStream(int render_process_id,
|
||||
int render_view_id) override;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "net/url_request/url_request_intercepting_job_factory.h"
|
||||
#include "net/url_request/url_request_job_factory_impl.h"
|
||||
#include "url/url_constants.h"
|
||||
#include "webkit/browser/quota/special_storage_policy.h"
|
||||
#include "storage/browser/quota/special_storage_policy.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
|
@ -120,7 +120,7 @@ URLRequestContextGetter::URLRequestContextGetter(
|
|||
// must synchronously run on the glib message loop. This will be passed to
|
||||
// the URLRequestContextStorage on the IO thread in GetURLRequestContext().
|
||||
proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService(
|
||||
io_loop_->message_loop_proxy(), file_loop_));
|
||||
io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy()));
|
||||
}
|
||||
|
||||
URLRequestContextGetter::~URLRequestContextGetter() {
|
||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
|||
Subproject commit f9abe65eddd9f233e215151c7487ac19af2a60d9
|
||||
Subproject commit 7b360df11d8797769930b616e48feccf74978359
|
Loading…
Reference in a new issue