Merge remote-tracking branch 'origin/master' into chrome52
This commit is contained in:
commit
4f3e9df055
16 changed files with 45 additions and 36 deletions
|
@ -85,16 +85,13 @@ class BrowserContext::ResourceContext : public content::ResourceContext {
|
||||||
BrowserContext::BrowserContextMap BrowserContext::browser_context_map_;
|
BrowserContext::BrowserContextMap BrowserContext::browser_context_map_;
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_refptr<BrowserContext> BrowserContext::From(
|
scoped_refptr<BrowserContext> BrowserContext::Get(
|
||||||
const std::string& partition, bool in_memory) {
|
const std::string& partition, bool in_memory) {
|
||||||
PartitionKey key(partition, in_memory);
|
PartitionKey key(partition, in_memory);
|
||||||
if (browser_context_map_[key].get())
|
if (browser_context_map_[key].get())
|
||||||
return make_scoped_refptr(browser_context_map_[key].get());
|
return make_scoped_refptr(browser_context_map_[key].get());
|
||||||
|
|
||||||
auto browser_context = BrowserContext::Create(partition, in_memory);
|
return nullptr;
|
||||||
browser_context->InitPrefs();
|
|
||||||
browser_context_map_[key] = browser_context->weak_factory_.GetWeakPtr();
|
|
||||||
return browser_context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
||||||
|
@ -112,7 +109,10 @@ BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
||||||
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)));
|
||||||
|
|
||||||
|
InitPrefs();
|
||||||
content::BrowserContext::Initialize(this, path_);
|
content::BrowserContext::Initialize(this, path_);
|
||||||
|
|
||||||
|
browser_context_map_[PartitionKey(partition, in_memory)] = GetWeakPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserContext::~BrowserContext() {
|
BrowserContext::~BrowserContext() {
|
||||||
|
|
|
@ -30,13 +30,14 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
||||||
public content::BrowserContext,
|
public content::BrowserContext,
|
||||||
public brightray::URLRequestContextGetter::Delegate {
|
public brightray::URLRequestContextGetter::Delegate {
|
||||||
public:
|
public:
|
||||||
// Get or Create the BrowserContext according to its |partition| and |in_memory|.
|
// Get the BrowserContext according to its |partition| and |in_memory|,
|
||||||
static scoped_refptr<BrowserContext> From(
|
// empty pointer when be returned when there is no matching BrowserContext.
|
||||||
|
static scoped_refptr<BrowserContext> Get(
|
||||||
const std::string& partition, bool in_memory);
|
const std::string& partition, bool in_memory);
|
||||||
|
|
||||||
// Create a new BrowserContext, embedders should implement it on their own.
|
base::WeakPtr<BrowserContext> GetWeakPtr() {
|
||||||
static scoped_refptr<BrowserContext> Create(
|
return weak_factory_.GetWeakPtr();
|
||||||
const std::string& partition, bool in_memory);
|
}
|
||||||
|
|
||||||
// Get the request context, if there is no one, create it.
|
// Get the request context, if there is no one, create it.
|
||||||
URLRequestContextGetter* GetRequestContext();
|
URLRequestContextGetter* GetRequestContext();
|
||||||
|
|
|
@ -121,7 +121,7 @@ class DispatcherImpl : public DevToolsEmbedderMessageDispatcher {
|
||||||
bool Dispatch(const DispatchCallback& callback,
|
bool Dispatch(const DispatchCallback& callback,
|
||||||
const std::string& method,
|
const std::string& method,
|
||||||
const base::ListValue* params) override {
|
const base::ListValue* params) override {
|
||||||
HandlerMap::iterator it = handlers_.find(method);
|
auto it = handlers_.find(method);
|
||||||
return it != handlers_.end() && it->second.Run(callback, *params);
|
return it != handlers_.end() && it->second.Run(callback, *params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ class DispatcherImpl : public DevToolsEmbedderMessageDispatcher {
|
||||||
DevToolsEmbedderMessageDispatcher*
|
DevToolsEmbedderMessageDispatcher*
|
||||||
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
|
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
|
||||||
Delegate* delegate) {
|
Delegate* delegate) {
|
||||||
DispatcherImpl* d = new DispatcherImpl();
|
auto* d = new DispatcherImpl();
|
||||||
|
|
||||||
d->RegisterHandler("bringToFront", &Delegate::ActivateWindow, delegate);
|
d->RegisterHandler("bringToFront", &Delegate::ActivateWindow, delegate);
|
||||||
d->RegisterHandler("closeWindow", &Delegate::CloseWindow, delegate);
|
d->RegisterHandler("closeWindow", &Delegate::CloseWindow, delegate);
|
||||||
|
|
|
@ -160,7 +160,7 @@ void Index::SetTrigramsForFile(const FilePath& file_path,
|
||||||
const Time& time) {
|
const Time& time) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
||||||
FileId file_id = GetFileId(file_path);
|
FileId file_id = GetFileId(file_path);
|
||||||
vector<Trigram>::const_iterator it = index.begin();
|
auto it = index.begin();
|
||||||
for (; it != index.end(); ++it) {
|
for (; it != index.end(); ++it) {
|
||||||
Trigram trigram = *it;
|
Trigram trigram = *it;
|
||||||
index_[trigram].push_back(file_id);
|
index_[trigram].push_back(file_id);
|
||||||
|
|
|
@ -89,7 +89,7 @@ class DevToolsDelegate :
|
||||||
public devtools_http_handler::DevToolsHttpHandlerDelegate {
|
public devtools_http_handler::DevToolsHttpHandlerDelegate {
|
||||||
public:
|
public:
|
||||||
DevToolsDelegate();
|
DevToolsDelegate();
|
||||||
virtual ~DevToolsDelegate();
|
~DevToolsDelegate() override;
|
||||||
|
|
||||||
// devtools_http_handler::DevToolsHttpHandlerDelegate.
|
// devtools_http_handler::DevToolsHttpHandlerDelegate.
|
||||||
std::string GetDiscoveryPageHTML() override;
|
std::string GetDiscoveryPageHTML() override;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/browser/web_ui.h"
|
#include "content/public/browser/web_ui.h"
|
||||||
|
|
||||||
using content::WebContents;
|
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
@ -114,7 +113,7 @@ class BundledDataSource : public content::URLDataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~BundledDataSource() {}
|
~BundledDataSource() override {}
|
||||||
DISALLOW_COPY_AND_ASSIGN(BundledDataSource);
|
DISALLOW_COPY_AND_ASSIGN(BundledDataSource);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,14 @@ bool IsPointInRect(const gfx::Point& point, const gfx::Rect& rect) {
|
||||||
point.y() > rect.y() && point.y() < (rect.height() + rect.y());
|
point.y() > rect.y() && point.y() < (rect.height() + rect.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsPointInScreen(const gfx::Point& point) {
|
||||||
|
for (const auto& display : gfx::Screen::GetScreen()->GetAllDisplays()) {
|
||||||
|
if (IsPointInRect(point, display.bounds()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SetZoomLevelForWebContents(content::WebContents* web_contents,
|
void SetZoomLevelForWebContents(content::WebContents* web_contents,
|
||||||
double level) {
|
double level) {
|
||||||
content::HostZoomMap::SetZoomLevel(web_contents, level);
|
content::HostZoomMap::SetZoomLevel(web_contents, level);
|
||||||
|
@ -165,7 +173,7 @@ int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
|
||||||
int ResponseWriter::Write(net::IOBuffer* buffer,
|
int ResponseWriter::Write(net::IOBuffer* buffer,
|
||||||
int num_bytes,
|
int num_bytes,
|
||||||
const net::CompletionCallback& callback) {
|
const net::CompletionCallback& callback) {
|
||||||
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
|
auto* id = new base::FundamentalValue(stream_id_);
|
||||||
base::StringValue* chunk =
|
base::StringValue* chunk =
|
||||||
new base::StringValue(std::string(buffer->data(), num_bytes));
|
new base::StringValue(std::string(buffer->data(), num_bytes));
|
||||||
|
|
||||||
|
@ -212,9 +220,9 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
|
||||||
devtools_bounds_.set_height(600);
|
devtools_bounds_.set_height(600);
|
||||||
devtools_bounds_.set_width(800);
|
devtools_bounds_.set_width(800);
|
||||||
}
|
}
|
||||||
gfx::Rect display = display::Screen::GetScreen()
|
if (!IsPointInScreen(devtools_bounds_.origin())) {
|
||||||
->GetDisplayNearestWindow(web_contents->GetNativeView()).bounds();
|
gfx::Rect display = gfx::Screen::GetScreen()->
|
||||||
if (!IsPointInRect(devtools_bounds_.origin(), display)) {
|
GetDisplayNearestWindow(web_contents->GetNativeView()).bounds();
|
||||||
devtools_bounds_.set_x(display.x() + (display.width() - devtools_bounds_.width()) / 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);
|
devtools_bounds_.set_y(display.y() + (display.height() - devtools_bounds_.height()) / 2);
|
||||||
}
|
}
|
||||||
|
@ -681,11 +689,11 @@ void InspectableWebContentsImpl::DidStartNavigationToPendingEntry(
|
||||||
|
|
||||||
void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) {
|
void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) {
|
||||||
DCHECK(source);
|
DCHECK(source);
|
||||||
PendingRequestsMap::iterator it = pending_requests_.find(source);
|
auto it = pending_requests_.find(source);
|
||||||
DCHECK(it != pending_requests_.end());
|
DCHECK(it != pending_requests_.end());
|
||||||
|
|
||||||
base::DictionaryValue response;
|
base::DictionaryValue response;
|
||||||
base::DictionaryValue* headers = new base::DictionaryValue();
|
auto* headers = new base::DictionaryValue();
|
||||||
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
|
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
|
||||||
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
|
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
|
||||||
response.Set("headers", headers);
|
response.Set("headers", headers);
|
||||||
|
|
|
@ -20,13 +20,13 @@ namespace {
|
||||||
const content::MediaStreamDevice* FindDeviceWithId(
|
const content::MediaStreamDevice* FindDeviceWithId(
|
||||||
const content::MediaStreamDevices& devices,
|
const content::MediaStreamDevices& devices,
|
||||||
const std::string& device_id) {
|
const std::string& device_id) {
|
||||||
content::MediaStreamDevices::const_iterator iter = devices.begin();
|
auto iter = devices.begin();
|
||||||
for (; iter != devices.end(); ++iter) {
|
for (; iter != devices.end(); ++iter) {
|
||||||
if (iter->id == device_id) {
|
if (iter->id == device_id) {
|
||||||
return &(*iter);
|
return &(*iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MediaStreamDevices& EmptyDevices() {
|
const MediaStreamDevices& EmptyDevices() {
|
||||||
|
@ -100,7 +100,7 @@ MediaCaptureDevicesDispatcher::GetFirstAvailableAudioDevice() {
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices();
|
const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices();
|
||||||
if (audio_devices.empty())
|
if (audio_devices.empty())
|
||||||
return NULL;
|
return nullptr;
|
||||||
return &(*audio_devices.begin());
|
return &(*audio_devices.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ MediaCaptureDevicesDispatcher::GetFirstAvailableVideoDevice() {
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices();
|
const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices();
|
||||||
if (video_devices.empty())
|
if (video_devices.empty())
|
||||||
return NULL;
|
return nullptr;
|
||||||
return &(*video_devices.begin());
|
return &(*video_devices.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void MediaStreamDevicesController::Accept() {
|
||||||
if (microphone_requested_ || webcam_requested_) {
|
if (microphone_requested_ || webcam_requested_) {
|
||||||
switch (request_.request_type) {
|
switch (request_.request_type) {
|
||||||
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY: {
|
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY: {
|
||||||
const content::MediaStreamDevice* device = NULL;
|
const content::MediaStreamDevice* device = nullptr;
|
||||||
// For open device request pick the desired device or fall back to the
|
// For open device request pick the desired device or fall back to the
|
||||||
// first available of the given type.
|
// first available of the given type.
|
||||||
if (request_.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE) {
|
if (request_.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ void DevToolsNetworkController::SetNetworkState(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_offline_interceptors = false;
|
bool has_offline_interceptors = false;
|
||||||
InterceptorMap::iterator it = interceptors_.begin();
|
auto it = interceptors_.begin();
|
||||||
for (; it != interceptors_.end(); ++it) {
|
for (; it != interceptors_.end(); ++it) {
|
||||||
if (it->second->IsOffline()) {
|
if (it->second->IsOffline()) {
|
||||||
has_offline_interceptors = true;
|
has_offline_interceptors = true;
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/devtools_agent_host.h"
|
#include "content/public/browser/devtools_agent_host.h"
|
||||||
|
|
||||||
using content::BrowserThread;
|
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ std::unique_ptr<base::DictionaryValue> GetConstants() {
|
||||||
std::unique_ptr<base::DictionaryValue> constants = net::GetNetConstants();
|
std::unique_ptr<base::DictionaryValue> constants = net::GetNetConstants();
|
||||||
|
|
||||||
// Adding client information to constants dictionary.
|
// Adding client information to constants dictionary.
|
||||||
base::DictionaryValue* client_info = new base::DictionaryValue();
|
auto* client_info = new base::DictionaryValue();
|
||||||
client_info->SetString(
|
client_info->SetString(
|
||||||
"command_line",
|
"command_line",
|
||||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
||||||
|
|
|
@ -221,12 +221,12 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
auto cookie_config = content::CookieStoreConfig(
|
auto cookie_config = content::CookieStoreConfig(
|
||||||
base_path_.Append(FILE_PATH_LITERAL("Cookies")),
|
base_path_.Append(FILE_PATH_LITERAL("Cookies")),
|
||||||
content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
|
content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
|
||||||
NULL, NULL);
|
nullptr, nullptr);
|
||||||
cookie_store = content::CreateCookieStore(cookie_config);
|
cookie_store = content::CreateCookieStore(cookie_config);
|
||||||
}
|
}
|
||||||
storage_->set_cookie_store(std::move(cookie_store));
|
storage_->set_cookie_store(std::move(cookie_store));
|
||||||
storage_->set_channel_id_service(base::WrapUnique(
|
storage_->set_channel_id_service(base::WrapUnique(
|
||||||
new net::ChannelIDService(new net::DefaultChannelIDStore(NULL),
|
new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr),
|
||||||
base::WorkerPool::GetTaskRunner(true))));
|
base::WorkerPool::GetTaskRunner(true))));
|
||||||
|
|
||||||
std::string accept_lang = l10n_util::GetApplicationLocale("");
|
std::string accept_lang = l10n_util::GetApplicationLocale("");
|
||||||
|
@ -270,7 +270,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
|
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
|
||||||
dhcp_factory.Create(url_request_context_.get()),
|
dhcp_factory.Create(url_request_context_.get()),
|
||||||
host_resolver.get(),
|
host_resolver.get(),
|
||||||
NULL,
|
nullptr,
|
||||||
url_request_context_->network_delegate()));
|
url_request_context_->network_delegate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,9 @@ bool InspectableWebContentsViewViews::IsDevToolsViewShowing() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InspectableWebContentsViewViews::IsDevToolsViewFocused() {
|
bool InspectableWebContentsViewViews::IsDevToolsViewFocused() {
|
||||||
if (devtools_web_view_)
|
if (devtools_window_web_view_)
|
||||||
|
return devtools_window_web_view_->HasFocus();
|
||||||
|
else if (devtools_web_view_)
|
||||||
return devtools_web_view_->HasFocus();
|
return devtools_web_view_->HasFocus();
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -54,7 +54,7 @@ content::WebUIController* WebUIControllerFactory::CreateWebUIControllerForURL(
|
||||||
auto browser_context = web_ui->GetWebContents()->GetBrowserContext();
|
auto browser_context = web_ui->GetWebContents()->GetBrowserContext();
|
||||||
return new DevToolsUI(browser_context, web_ui);
|
return new DevToolsUI(browser_context, web_ui);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 1dd3cbf7c4d3cc6511fa1a2a145b0e9cd86752b6
|
Subproject commit 0b5aa7b6ca450681c58087e14f72238aab5ab823
|
Loading…
Add table
Add a link
Reference in a new issue