Merge pull request #112 from atom/devtools-load-network-resources

Fix networking requests not loading in devtools
This commit is contained in:
Cheng Zhao 2015-06-05 12:27:00 +08:00
commit 44ba4e87aa
18 changed files with 547 additions and 380 deletions

View file

@ -33,11 +33,11 @@ class BrowserContext::ResourceContext : public content::ResourceContext {
}
private:
virtual net::HostResolver* GetHostResolver() override {
net::HostResolver* GetHostResolver() override {
return getter_->host_resolver();
}
virtual net::URLRequestContext* GetRequestContext() override {
net::URLRequestContext* GetRequestContext() override {
return getter_->GetURLRequestContext();
}

View file

@ -40,9 +40,9 @@ class BrowserContext : public content::BrowserContext,
virtual void RegisterPrefs(PrefRegistrySimple* pref_registry) {}
// URLRequestContextGetter::Delegate:
virtual net::NetworkDelegate* CreateNetworkDelegate() override;
net::NetworkDelegate* CreateNetworkDelegate() override;
virtual base::FilePath GetPath() const override;
base::FilePath GetPath() const override;
private:
class ResourceContext;

View file

@ -39,12 +39,12 @@ class BrowserMainParts : public content::BrowserMainParts {
protected:
// content::BrowserMainParts:
virtual void PreEarlyInitialization() override;
virtual void ToolkitInitialized() override;
virtual void PreMainMessageLoopStart() override;
virtual void PreMainMessageLoopRun() override;
virtual void PostMainMessageLoopRun() override;
virtual int PreCreateThreads() override;
void PreEarlyInitialization() override;
void ToolkitInitialized() override;
void PreMainMessageLoopStart() override;
void PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() override;
int PreCreateThreads() override;
// Subclasses should override this to provide their own BrowserContxt
// implementation. The caller takes ownership of the returned object.

View file

@ -11,21 +11,23 @@ namespace brightray {
namespace {
bool GetValue(const base::ListValue& list, int pos, std::string& value) {
return list.GetString(pos, &value);
using DispatchCallback = DevToolsEmbedderMessageDispatcher::DispatchCallback;
bool GetValue(const base::Value* value, std::string* result) {
return value->GetAsString(result);
}
bool GetValue(const base::ListValue& list, int pos, int& value) {
return list.GetInteger(pos, &value);
bool GetValue(const base::Value* value, int* result) {
return value->GetAsInteger(result);
}
bool GetValue(const base::ListValue& list, int pos, bool& value) {
return list.GetBoolean(pos, &value);
bool GetValue(const base::Value* value, bool* result) {
return value->GetAsBoolean(result);
}
bool GetValue(const base::ListValue& list, int pos, gfx::Rect& rect) {
bool GetValue(const base::Value* value, gfx::Rect* rect) {
const base::DictionaryValue* dict;
if (!list.GetDictionary(pos, &dict))
if (!value->GetAsDictionary(&dict))
return false;
int x = 0;
int y = 0;
@ -36,217 +38,164 @@ bool GetValue(const base::ListValue& list, int pos, gfx::Rect& rect) {
!dict->GetInteger("width", &width) ||
!dict->GetInteger("height", &height))
return false;
rect.SetRect(x, y, width, height);
rect->SetRect(x, y, width, height);
return true;
}
template <typename T>
struct StorageTraits {
typedef T StorageType;
using StorageType = T;
};
template <typename T>
struct StorageTraits<const T&> {
typedef T StorageType;
using StorageType = T;
};
template <class A>
class Argument {
public:
typedef typename StorageTraits<A>::StorageType ValueType;
Argument(const base::ListValue& list, int pos) {
valid_ = GetValue(list, pos, value_);
template <typename... Ts>
struct ParamTuple {
bool Parse(const base::ListValue& list,
const base::ListValue::const_iterator& it) {
return it == list.end();
}
ValueType value() const { return value_; }
bool valid() const { return valid_; }
private:
ValueType value_;
bool valid_;
template <typename H, typename... As>
void Apply(const H& handler, As... args) {
handler.Run(args...);
}
};
bool ParseAndHandle0(const base::Callback<void(void)>& handler,
const base::ListValue& list) {
handler.Run();
template <typename T, typename... Ts>
struct ParamTuple<T, Ts...> {
bool Parse(const base::ListValue& list,
const base::ListValue::const_iterator& it) {
return it != list.end() && GetValue(*it, &head) && tail.Parse(list, it + 1);
}
template <typename H, typename... As>
void Apply(const H& handler, As... args) {
tail.template Apply<H, As..., T>(handler, args..., head);
}
typename StorageTraits<T>::StorageType head;
ParamTuple<Ts...> tail;
};
template<typename... As>
bool ParseAndHandle(const base::Callback<void(As...)>& handler,
const DispatchCallback& callback,
const base::ListValue& list) {
ParamTuple<As...> tuple;
if (!tuple.Parse(list, list.begin()))
return false;
tuple.Apply(handler);
return true;
}
template <class A1>
bool ParseAndHandle1(const base::Callback<void(A1)>& handler,
const base::ListValue& list) {
if (list.GetSize() != 1)
template<typename... As>
bool ParseAndHandleWithCallback(
const base::Callback<void(const DispatchCallback&, As...)>& handler,
const DispatchCallback& callback,
const base::ListValue& list) {
ParamTuple<As...> tuple;
if (!tuple.Parse(list, list.begin()))
return false;
Argument<A1> arg1(list, 0);
if (!arg1.valid())
return false;
handler.Run(arg1.value());
tuple.Apply(handler, callback);
return true;
}
template <class A1, class A2>
bool ParseAndHandle2(const base::Callback<void(A1, A2)>& handler,
const base::ListValue& list) {
if (list.GetSize() != 2)
return false;
Argument<A1> arg1(list, 0);
if (!arg1.valid())
return false;
Argument<A2> arg2(list, 1);
if (!arg2.valid())
return false;
handler.Run(arg1.value(), arg2.value());
return true;
}
template <class A1, class A2, class A3>
bool ParseAndHandle3(const base::Callback<void(A1, A2, A3)>& handler,
const base::ListValue& list) {
if (list.GetSize() != 3)
return false;
Argument<A1> arg1(list, 0);
if (!arg1.valid())
return false;
Argument<A2> arg2(list, 1);
if (!arg2.valid())
return false;
Argument<A3> arg3(list, 2);
if (!arg3.valid())
return false;
handler.Run(arg1.value(), arg2.value(), arg3.value());
return true;
}
template <class A1, class A2, class A3, class A4>
bool ParseAndHandle3(const base::Callback<void(A1, A2, A3, A4)>& handler,
const base::ListValue& list) {
if (list.GetSize() != 3)
return false;
Argument<A1> arg1(list, 0);
if (!arg1.valid())
return false;
Argument<A2> arg2(list, 1);
if (!arg2.valid())
return false;
Argument<A3> arg3(list, 2);
if (!arg3.valid())
return false;
Argument<A4> arg4(list, 3);
if (!arg4.valid())
return false;
handler.Run(arg1.value(), arg2.value(), arg3.value(), arg4.value());
return true;
}
typedef base::Callback<bool (const base::ListValue&)> ListValueParser;
ListValueParser BindToListParser(const base::Callback<void()>& handler) {
return base::Bind(&ParseAndHandle0, handler);
}
template <class A1>
ListValueParser BindToListParser(const base::Callback<void(A1)>& handler) {
return base::Bind(&ParseAndHandle1<A1>, handler);
}
template <class A1, class A2>
ListValueParser BindToListParser(const base::Callback<void(A1, A2)>& handler) {
return base::Bind(&ParseAndHandle2<A1, A2>, handler);
}
template <class A1, class A2, class A3>
ListValueParser BindToListParser(
const base::Callback<void(A1, A2, A3)>& handler) {
return base::Bind(&ParseAndHandle3<A1, A2, A3>, handler);
}
template <class A1, class A2, class A3, class A4>
ListValueParser BindToListParser(
const base::Callback<void(A1, A2, A3, A4)>& handler) {
return base::Bind(&ParseAndHandle3<A1, A2, A3, A4>, handler);
}
} // namespace
DevToolsEmbedderMessageDispatcher::DevToolsEmbedderMessageDispatcher(
/**
* Dispatcher for messages sent from the frontend running in an
* isolated renderer (chrome-devtools:// or chrome://inspect) to the embedder
* in the browser.
*
* The messages are sent via InspectorFrontendHost.sendMessageToEmbedder or
* chrome.send method accordingly.
*/
class DispatcherImpl : public DevToolsEmbedderMessageDispatcher {
public:
~DispatcherImpl() override {}
bool Dispatch(const DispatchCallback& callback,
const std::string& method,
const base::ListValue* params) override {
HandlerMap::iterator it = handlers_.find(method);
return it != handlers_.end() && it->second.Run(callback, *params);
}
template<typename... As>
void RegisterHandler(const std::string& method,
void (Delegate::*handler)(As...),
Delegate* delegate) {
handlers_[method] = base::Bind(&ParseAndHandle<As...>,
base::Bind(handler,
base::Unretained(delegate)));
}
template<typename... As>
void RegisterHandlerWithCallback(
const std::string& method,
void (Delegate::*handler)(const DispatchCallback&, As...),
Delegate* delegate) {
handlers_[method] = base::Bind(&ParseAndHandleWithCallback<As...>,
base::Bind(handler,
base::Unretained(delegate)));
}
private:
using Handler = base::Callback<bool(const DispatchCallback&,
const base::ListValue&)>;
using HandlerMap = std::map<std::string, Handler>;
HandlerMap handlers_;
};
// static
DevToolsEmbedderMessageDispatcher*
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
Delegate* delegate) {
RegisterHandler("bringToFront",
BindToListParser(base::Bind(&Delegate::ActivateWindow,
base::Unretained(delegate))));
RegisterHandler("closeWindow",
BindToListParser(base::Bind(&Delegate::CloseWindow,
base::Unretained(delegate))));
RegisterHandler("setInspectedPageBounds",
BindToListParser(base::Bind(&Delegate::SetInspectedPageBounds,
base::Unretained(delegate))));
RegisterHandler("inspectElementCompleted",
BindToListParser(base::Bind(&Delegate::InspectElementCompleted,
base::Unretained(delegate))));
RegisterHandler("moveWindowBy",
BindToListParser(base::Bind(&Delegate::MoveWindow,
base::Unretained(delegate))));
RegisterHandler("setIsDocked",
BindToListParser(base::Bind(&Delegate::SetIsDocked,
base::Unretained(delegate))));
RegisterHandler("openInNewTab",
BindToListParser(base::Bind(&Delegate::OpenInNewTab,
base::Unretained(delegate))));
RegisterHandler("save",
BindToListParser(base::Bind(&Delegate::SaveToFile,
base::Unretained(delegate))));
RegisterHandler("append",
BindToListParser(base::Bind(&Delegate::AppendToFile,
base::Unretained(delegate))));
RegisterHandler("requestFileSystems",
BindToListParser(base::Bind(&Delegate::RequestFileSystems,
base::Unretained(delegate))));
RegisterHandler("addFileSystem",
BindToListParser(base::Bind(&Delegate::AddFileSystem,
base::Unretained(delegate))));
RegisterHandler("removeFileSystem",
BindToListParser(base::Bind(&Delegate::RemoveFileSystem,
base::Unretained(delegate))));
RegisterHandler("upgradeDraggedFileSystemPermissions",
BindToListParser(base::Bind(&Delegate::UpgradeDraggedFileSystemPermissions,
base::Unretained(delegate))));
RegisterHandler("indexPath",
BindToListParser(base::Bind(&Delegate::IndexPath,
base::Unretained(delegate))));
RegisterHandler("stopIndexing",
BindToListParser(base::Bind(&Delegate::StopIndexing,
base::Unretained(delegate))));
RegisterHandler("searchInPath",
BindToListParser(base::Bind(&Delegate::SearchInPath,
base::Unretained(delegate))));
RegisterHandler("zoomIn",
BindToListParser(base::Bind(&Delegate::ZoomIn,
base::Unretained(delegate))));
RegisterHandler("zoomOut",
BindToListParser(base::Bind(&Delegate::ZoomOut,
base::Unretained(delegate))));
RegisterHandler("resetZoom",
BindToListParser(base::Bind(&Delegate::ResetZoom,
base::Unretained(delegate))));
}
DispatcherImpl* d = new DispatcherImpl();
DevToolsEmbedderMessageDispatcher::~DevToolsEmbedderMessageDispatcher() {}
std::string DevToolsEmbedderMessageDispatcher::Dispatch(
const std::string& method, base::ListValue* params) {
HandlerMap::iterator it = handlers_.find(method);
if (it == handlers_.end())
return "Unsupported frontend host method: " + method;
if (!it->second.Run(*params))
return "Invalid frontend host message parameters: " + method;
return "";
}
void DevToolsEmbedderMessageDispatcher::RegisterHandler(
const std::string& method, const Handler& handler) {
handlers_[method] = handler;
d->RegisterHandler("bringToFront", &Delegate::ActivateWindow, delegate);
d->RegisterHandler("closeWindow", &Delegate::CloseWindow, delegate);
d->RegisterHandler("loadCompleted", &Delegate::LoadCompleted, delegate);
d->RegisterHandler("setInspectedPageBounds",
&Delegate::SetInspectedPageBounds, delegate);
d->RegisterHandler("inspectElementCompleted",
&Delegate::InspectElementCompleted, delegate);
d->RegisterHandler("inspectedURLChanged",
&Delegate::InspectedURLChanged, delegate);
d->RegisterHandlerWithCallback("setIsDocked",
&Delegate::SetIsDocked, delegate);
d->RegisterHandler("openInNewTab", &Delegate::OpenInNewTab, delegate);
d->RegisterHandler("save", &Delegate::SaveToFile, delegate);
d->RegisterHandler("append", &Delegate::AppendToFile, delegate);
d->RegisterHandler("requestFileSystems",
&Delegate::RequestFileSystems, delegate);
d->RegisterHandler("addFileSystem", &Delegate::AddFileSystem, delegate);
d->RegisterHandler("removeFileSystem", &Delegate::RemoveFileSystem, delegate);
d->RegisterHandler("upgradeDraggedFileSystemPermissions",
&Delegate::UpgradeDraggedFileSystemPermissions, delegate);
d->RegisterHandler("indexPath", &Delegate::IndexPath, delegate);
d->RegisterHandlerWithCallback("loadNetworkResource",
&Delegate::LoadNetworkResource, delegate);
d->RegisterHandler("stopIndexing", &Delegate::StopIndexing, delegate);
d->RegisterHandler("searchInPath", &Delegate::SearchInPath, delegate);
d->RegisterHandler("setWhitelistedShortcuts",
&Delegate::SetWhitelistedShortcuts, delegate);
d->RegisterHandler("zoomIn", &Delegate::ZoomIn, delegate);
d->RegisterHandler("zoomOut", &Delegate::ZoomOut, delegate);
d->RegisterHandler("resetZoom", &Delegate::ResetZoom, delegate);
d->RegisterHandler("setDevicesUpdatesEnabled",
&Delegate::SetDevicesUpdatesEnabled, delegate);
d->RegisterHandler("sendMessageToBrowser",
&Delegate::SendMessageToBrowser, delegate);
d->RegisterHandler("recordActionUMA", &Delegate::RecordActionUMA, delegate);
d->RegisterHandlerWithCallback("sendJsonRequest",
&Delegate::SendJsonRequest, delegate);
return d;
}
} // namespace brightray

View file

@ -15,6 +15,7 @@
namespace base {
class ListValue;
class Value;
}
namespace brightray {
@ -29,14 +30,18 @@ class DevToolsEmbedderMessageDispatcher {
public:
class Delegate {
public:
using DispatchCallback = base::Callback<void(const base::Value*)>;
virtual ~Delegate() {}
virtual void ActivateWindow() = 0;
virtual void CloseWindow() = 0;
virtual void LoadCompleted() = 0;
virtual void SetInspectedPageBounds(const gfx::Rect& rect) = 0;
virtual void InspectElementCompleted() = 0;
virtual void MoveWindow(int x, int y) = 0;
virtual void SetIsDocked(bool docked) = 0;
virtual void InspectedURLChanged(const std::string& url) = 0;
virtual void SetIsDocked(const DispatchCallback& callback,
bool is_docked) = 0;
virtual void OpenInNewTab(const std::string& url) = 0;
virtual void SaveToFile(const std::string& url,
const std::string& content,
@ -48,29 +53,37 @@ class DevToolsEmbedderMessageDispatcher {
virtual void RemoveFileSystem(const std::string& file_system_path) = 0;
virtual void UpgradeDraggedFileSystemPermissions(
const std::string& file_system_url) = 0;
virtual void IndexPath(int request_id,
virtual void IndexPath(int index_request_id,
const std::string& file_system_path) = 0;
virtual void StopIndexing(int request_id) = 0;
virtual void SearchInPath(int request_id,
virtual void StopIndexing(int index_request_id) = 0;
virtual void LoadNetworkResource(const DispatchCallback& callback,
const std::string& url,
const std::string& headers,
int stream_id) = 0;
virtual void SearchInPath(int search_request_id,
const std::string& file_system_path,
const std::string& query) = 0;
virtual void SetWhitelistedShortcuts(const std::string& message) = 0;
virtual void ZoomIn() = 0;
virtual void ZoomOut() = 0;
virtual void ResetZoom() = 0;
virtual void SetDevicesUpdatesEnabled(bool enabled) = 0;
virtual void SendMessageToBrowser(const std::string& message) = 0;
virtual void RecordActionUMA(const std::string& name, int action) = 0;
virtual void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
const std::string& url) = 0;
};
explicit DevToolsEmbedderMessageDispatcher(Delegate* delegate);
using DispatchCallback = Delegate::DispatchCallback;
~DevToolsEmbedderMessageDispatcher();
virtual ~DevToolsEmbedderMessageDispatcher() {}
virtual bool Dispatch(const DispatchCallback& callback,
const std::string& method,
const base::ListValue* params) = 0;
std::string Dispatch(const std::string& method, base::ListValue* params);
private:
typedef base::Callback<bool (const base::ListValue&)> Handler;
void RegisterHandler(const std::string& method, const Handler& handler);
typedef std::map<std::string, Handler> HandlerMap;
HandlerMap handlers_;
static DevToolsEmbedderMessageDispatcher* CreateForDevToolsFrontend(
Delegate* delegate);
};
} // namespace brightray

View file

@ -52,18 +52,17 @@ std::string GetMimeTypeForPath(const std::string& path) {
class BundledDataSource : public content::URLDataSource {
public:
explicit BundledDataSource() {
}
BundledDataSource() {}
// content::URLDataSource implementation.
virtual std::string GetSource() const override {
std::string GetSource() const override {
return kChromeUIDevToolsBundledHost;
}
virtual void StartDataRequest(const std::string& path,
int render_process_id,
int render_view_id,
const GotDataCallback& callback) override {
void StartDataRequest(const std::string& path,
int render_process_id,
int render_view_id,
const GotDataCallback& callback) override {
std::string filename = PathWithoutParams(path);
int resource_id =
@ -79,19 +78,19 @@ class BundledDataSource : public content::URLDataSource {
callback.Run(bytes.get());
}
virtual std::string GetMimeType(const std::string& path) const override {
std::string GetMimeType(const std::string& path) const override {
return GetMimeTypeForPath(path);
}
virtual bool ShouldAddContentSecurityPolicy() const override {
bool ShouldAddContentSecurityPolicy() const override {
return false;
}
virtual bool ShouldDenyXFrameOptions() const override {
bool ShouldDenyXFrameOptions() const override {
return false;
}
virtual bool ShouldServeMimeTypeAsContentTypeHeader() const override {
bool ShouldServeMimeTypeAsContentTypeHeader() const override {
return true;
}

View file

@ -3,6 +3,10 @@
#include "content/public/browser/web_contents.h"
namespace base {
class Value;
}
namespace content {
class DevToolsAgentHost;
}
@ -14,8 +18,7 @@ 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.
@ -26,16 +29,20 @@ class InspectableWebContents {
virtual InspectableWebContentsView* GetView() const = 0;
virtual content::WebContents* GetWebContents() const = 0;
virtual void SetCanDock(bool can_dock) = 0;
virtual void ShowDevTools() = 0;
// Close the DevTools completely instead of just hide it.
virtual void CloseDevTools() = 0;
virtual bool IsDevToolsViewShowing() = 0;
virtual void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) = 0;
// The delegate manages its own life.
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0;
virtual InspectableWebContentsDelegate* GetDelegate() const = 0;
virtual void SetCanDock(bool can_dock) = 0;
virtual void ShowDevTools() = 0;
virtual void CloseDevTools() = 0;
virtual bool IsDevToolsViewShowing() = 0;
virtual void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) = 0;
virtual void Detach() = 0;
virtual void CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3) = 0;
};
} // namespace brightray

View file

@ -12,15 +12,21 @@
#include "browser/inspectable_web_contents_view.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_http_handler.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"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_response_writer.h"
namespace brightray {
@ -41,6 +47,13 @@ const char kFrontendHostId[] = "id";
const char kFrontendHostMethod[] = "method";
const char kFrontendHostParams[] = "params";
const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken";
const int kDevToolsActionTakenBoundary = 100;
const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown";
const int kDevToolsPanelShownBoundary = 20;
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
void RectToDictionary(const gfx::Rect& bounds, base::DictionaryValue* dict) {
dict->SetInteger("x", bounds.x());
dict->SetInteger("y", bounds.y());
@ -57,34 +70,6 @@ void DictionaryToRect(const base::DictionaryValue& dict, gfx::Rect* bounds) {
*bounds = gfx::Rect(x, y, width, height);
}
bool ParseMessage(const std::string& message,
std::string* method,
base::ListValue* params,
int* id) {
scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
if (!parsed_message)
return false;
base::DictionaryValue* dict = NULL;
if (!parsed_message->GetAsDictionary(&dict))
return false;
if (!dict->GetString(kFrontendHostMethod, method))
return false;
// "params" is optional.
if (dict->HasKey(kFrontendHostParams)) {
base::ListValue* internal_params;
if (dict->GetList(kFrontendHostParams, &internal_params))
params->Swap(internal_params);
else
return false;
}
*id = 0;
dict->GetInteger(kFrontendHostId, id);
return true;
}
double GetZoomLevelForWebContents(content::WebContents* web_contents) {
return content::HostZoomMap::GetZoomLevel(web_contents);
}
@ -107,6 +92,59 @@ double GetNextZoomLevel(double level, bool out) {
return level;
}
// ResponseWriter -------------------------------------------------------------
class ResponseWriter : public net::URLFetcherResponseWriter {
public:
ResponseWriter(base::WeakPtr<InspectableWebContentsImpl> bindings, int stream_id);
~ResponseWriter() override;
// URLFetcherResponseWriter overrides:
int Initialize(const net::CompletionCallback& callback) override;
int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) override;
int Finish(const net::CompletionCallback& callback) override;
private:
base::WeakPtr<InspectableWebContentsImpl> bindings_;
int stream_id_;
DISALLOW_COPY_AND_ASSIGN(ResponseWriter);
};
ResponseWriter::ResponseWriter(base::WeakPtr<InspectableWebContentsImpl> bindings,
int stream_id)
: bindings_(bindings),
stream_id_(stream_id) {
}
ResponseWriter::~ResponseWriter() {
}
int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
return net::OK;
}
int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
base::StringValue* chunk =
new base::StringValue(std::string(buffer->data(), num_bytes));
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&InspectableWebContentsImpl::CallClientFunction,
bindings_, "DevToolsAPI.streamWrite",
base::Owned(id), base::Owned(chunk), nullptr));
return num_bytes;
}
int ResponseWriter::Finish(const net::CompletionCallback& callback) {
return net::OK;
}
} // namespace
// Implemented separately on each platform.
@ -122,8 +160,10 @@ void InspectableWebContentsImpl::RegisterPrefs(PrefRegistrySimple* registry) {
InspectableWebContentsImpl::InspectableWebContentsImpl(
content::WebContents* web_contents)
: web_contents_(web_contents),
frontend_loaded_(false),
can_dock_(true),
delegate_(nullptr) {
delegate_(nullptr),
weak_factory_(this) {
auto context = static_cast<BrowserContext*>(web_contents_->GetBrowserContext());
auto bounds_dict = context->prefs()->GetDictionary(kDevToolsBoundsPref);
if (bounds_dict)
@ -143,6 +183,14 @@ content::WebContents* InspectableWebContentsImpl::GetWebContents() const {
return web_contents_.get();
}
void InspectableWebContentsImpl::SetDelegate(InspectableWebContentsDelegate* delegate) {
delegate_ = delegate;
}
InspectableWebContentsDelegate* InspectableWebContentsImpl::GetDelegate() const {
return delegate_;
}
void InspectableWebContentsImpl::SetCanDock(bool can_dock) {
can_dock_ = can_dock;
}
@ -152,7 +200,7 @@ void InspectableWebContentsImpl::ShowDevTools() {
// SetIsDocked is called *BEFORE* ShowDevTools.
if (!devtools_web_contents_) {
embedder_message_dispatcher_.reset(
new DevToolsEmbedderMessageDispatcher(this));
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(this));
content::WebContents::CreateParams create_params(web_contents_->GetBrowserContext());
devtools_web_contents_.reset(content::WebContents::Create(create_params));
@ -200,6 +248,29 @@ 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) {
std::string javascript = function_name + "(";
if (arg1) {
std::string json;
base::JSONWriter::Write(arg1, &json);
javascript.append(json);
if (arg2) {
base::JSONWriter::Write(arg2, &json);
javascript.append(", ").append(json);
if (arg3) {
base::JSONWriter::Write(arg3, &json);
javascript.append(", ").append(json);
}
}
}
javascript.append(");");
devtools_web_contents_->GetMainFrame()->ExecuteJavaScript(
base::UTF8ToUTF16(javascript));
}
gfx::Rect InspectableWebContentsImpl::GetDevToolsBounds() const {
return devtools_bounds_;
}
@ -219,6 +290,15 @@ void InspectableWebContentsImpl::CloseWindow() {
devtools_web_contents()->DispatchBeforeUnload(false);
}
void InspectableWebContentsImpl::LoadCompleted() {
frontend_loaded_ = true;
view_->ShowDevTools();
// If the devtools can dock, "SetIsDocked" will be called by devtools itself.
if (!can_dock_)
SetIsDocked(DispatchCallback(), false);
}
void InspectableWebContentsImpl::SetInspectedPageBounds(const gfx::Rect& rect) {
DevToolsContentsResizingStrategy strategy(rect);
if (contents_resizing_strategy_.Equals(strategy))
@ -231,11 +311,39 @@ void InspectableWebContentsImpl::SetInspectedPageBounds(const gfx::Rect& rect) {
void InspectableWebContentsImpl::InspectElementCompleted() {
}
void InspectableWebContentsImpl::MoveWindow(int x, int y) {
void InspectableWebContentsImpl::InspectedURLChanged(const std::string& url) {
}
void InspectableWebContentsImpl::SetIsDocked(bool docked) {
void InspectableWebContentsImpl::LoadNetworkResource(
const DispatchCallback& callback,
const std::string& url,
const std::string& headers,
int stream_id) {
GURL gurl(url);
if (!gurl.is_valid()) {
base::DictionaryValue response;
response.SetInteger("statusCode", 404);
callback.Run(&response);
return;
}
auto browser_context = static_cast<BrowserContext*>(devtools_web_contents_->GetBrowserContext());
net::URLFetcher* fetcher =
net::URLFetcher::Create(gurl, net::URLFetcher::GET, this);
pending_requests_[fetcher] = callback;
fetcher->SetRequestContext(browser_context->url_request_context_getter());
fetcher->SetExtraRequestHeaders(headers);
fetcher->SaveResponseWithWriter(scoped_ptr<net::URLFetcherResponseWriter>(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
fetcher->Start();
}
void InspectableWebContentsImpl::SetIsDocked(const DispatchCallback& callback,
bool docked) {
view_->SetIsDocked(docked);
if (!callback.is_null())
callback.Run(nullptr);
}
void InspectableWebContentsImpl::OpenInNewTab(const std::string& url) {
@ -253,15 +361,9 @@ void InspectableWebContentsImpl::AppendToFile(
delegate_->DevToolsAppendToFile(url, content);
}
void InspectableWebContentsImpl::WebContentsFocused(
content::WebContents* contents) {
if (delegate_)
delegate_->DevToolsFocused();
}
void InspectableWebContentsImpl::RequestFileSystems() {
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([])"));
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([])"));
}
void InspectableWebContentsImpl::AddFileSystem() {
@ -292,6 +394,9 @@ void InspectableWebContentsImpl::SearchInPath(
const std::string& query) {
}
void InspectableWebContentsImpl::SetWhitelistedShortcuts(const std::string& message) {
}
void InspectableWebContentsImpl::ZoomIn() {
double level = GetZoomLevelForWebContents(devtools_web_contents());
SetZoomLevelForWebContents(devtools_web_contents(), GetNextZoomLevel(level, false));
@ -306,33 +411,76 @@ void InspectableWebContentsImpl::ResetZoom() {
SetZoomLevelForWebContents(devtools_web_contents(), 0.);
}
void InspectableWebContentsImpl::SetDevicesUpdatesEnabled(bool enabled) {
}
void InspectableWebContentsImpl::SendMessageToBrowser(const std::string& message) {
if (agent_host_.get())
agent_host_->DispatchProtocolMessage(message);
}
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) {
callback.Run(nullptr);
}
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::string& message) {
std::string method;
base::ListValue params;
int id;
if (!ParseMessage(message, &method, &params, &id)) {
base::ListValue empty_params;
base::ListValue* params = &empty_params;
base::DictionaryValue* dict = nullptr;
scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
if (!parsed_message ||
!parsed_message->GetAsDictionary(&dict) ||
!dict->GetString(kFrontendHostMethod, &method) ||
(dict->HasKey(kFrontendHostParams) &&
!dict->GetList(kFrontendHostParams, &params))) {
LOG(ERROR) << "Invalid message was sent to embedder: " << message;
return;
}
std::string error = embedder_message_dispatcher_->Dispatch(method, &params);
if (id) {
std::string ack = base::StringPrintf(
"DevToolsAPI.embedderMessageAck(%d, \"%s\");", id, error.c_str());
devtools_web_contents()->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(ack));
}
int id = 0;
dict->GetInteger(kFrontendHostId, &id);
embedder_message_dispatcher_->Dispatch(
base::Bind(&InspectableWebContentsImpl::SendMessageAck,
weak_factory_.GetWeakPtr(),
id),
method,
params);
}
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend(
const std::string& message) {
agent_host_->DispatchProtocolMessage(message);
if (agent_host_.get())
agent_host_->DispatchProtocolMessage(message);
}
void InspectableWebContentsImpl::DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host, const std::string& message) {
std::string code = "DevToolsAPI.dispatchMessage(" + message + ");";
base::string16 javascript = base::UTF8ToUTF16(code);
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
if (!frontend_loaded_)
return;
if (message.length() < kMaxMessageChunkSize) {
base::string16 javascript = base::UTF8ToUTF16(
"DevToolsAPI.dispatchMessage(" + message + ");");
devtools_web_contents_->GetMainFrame()->ExecuteJavaScript(javascript);
return;
}
base::FundamentalValue total_size(static_cast<int>(message.length()));
for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) {
base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize));
CallClientFunction("DevToolsAPI.dispatchMessageChunk",
&message_value, pos ? nullptr : &total_size, nullptr);
}
}
void InspectableWebContentsImpl::AgentHostClosed(
@ -347,22 +495,15 @@ void InspectableWebContentsImpl::AboutToNavigateRenderFrame(
frontend_host_.reset(content::DevToolsFrontendHost::Create(new_host, this));
}
void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) {
if (render_frame_host->GetParent())
return;
view_->ShowDevTools();
// If the devtools can dock, "SetIsDocked" will be called by devtools itself.
if (!can_dock_)
SetIsDocked(false);
}
void InspectableWebContentsImpl::WebContentsDestroyed() {
agent_host_->DetachClient();
frontend_loaded_ = false;
Observe(nullptr);
Detach();
agent_host_ = nullptr;
embedder_message_dispatcher_ = nullptr;
for (const auto& pair : pending_requests_)
delete pair.first;
}
bool InspectableWebContentsImpl::AddMessageToConsole(
@ -400,4 +541,39 @@ void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
CloseDevTools();
}
void InspectableWebContentsImpl::WebContentsFocused(
content::WebContents* contents) {
if (delegate_)
delegate_->DevToolsFocused();
}
void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(source);
PendingRequestsMap::iterator it = pending_requests_.find(source);
DCHECK(it != pending_requests_.end());
base::DictionaryValue response;
base::DictionaryValue* headers = new base::DictionaryValue();
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
response.Set("headers", headers);
void* iterator = nullptr;
std::string name;
std::string value;
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
headers->SetString(name, value);
it->second.Run(&response);
pending_requests_.erase(it);
delete source;
}
void InspectableWebContentsImpl::SendMessageAck(int request_id,
const base::Value* arg) {
base::FundamentalValue id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck",
&id_value, arg, nullptr);
}
} // namespace brightray

View file

@ -11,10 +11,12 @@
#include "browser/devtools_contents_resizing_strategy.h"
#include "browser/devtools_embedder_message_dispatcher.h"
#include "base/memory/weak_ptr.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"
#include "net/url_request/url_fetcher_delegate.h"
#include "ui/gfx/geometry/rect.h"
class PrefRegistrySimple;
@ -34,7 +36,8 @@ class InspectableWebContentsImpl :
public content::DevToolsAgentHostClient,
public content::WebContentsObserver,
public content::WebContentsDelegate,
public DevToolsEmbedderMessageDispatcher::Delegate {
public DevToolsEmbedderMessageDispatcher::Delegate,
public net::URLFetcherDelegate {
public:
static void RegisterPrefs(PrefRegistrySimple* pref_registry);
@ -44,25 +47,23 @@ class InspectableWebContentsImpl :
InspectableWebContentsView* GetView() const override;
content::WebContents* GetWebContents() const override;
void SetDelegate(InspectableWebContentsDelegate* delegate) override;
InspectableWebContentsDelegate* GetDelegate() const override;
void SetCanDock(bool can_dock) override;
void ShowDevTools() override;
void CloseDevTools() override;
bool IsDevToolsViewShowing() override;
void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) override;
void Detach();
void Detach() override;
void CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3) override;
// Return the last position and size of devtools window.
gfx::Rect GetDevToolsBounds() const;
void SaveDevToolsBounds(const gfx::Rect& bounds);
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) {
delegate_ = delegate;
}
virtual InspectableWebContentsDelegate* GetDelegate() const {
return delegate_;
}
content::WebContents* devtools_web_contents() {
return devtools_web_contents_.get();
}
@ -71,10 +72,15 @@ class InspectableWebContentsImpl :
// DevToolsEmbedderMessageDispacher::Delegate
void ActivateWindow() override;
void CloseWindow() override;
void LoadCompleted() override;
void SetInspectedPageBounds(const gfx::Rect& rect) override;
void InspectElementCompleted() override;
void MoveWindow(int x, int y) override;
void SetIsDocked(bool docked) override;
void InspectedURLChanged(const std::string& url) override;
void LoadNetworkResource(const DispatchCallback& callback,
const std::string& url,
const std::string& headers,
int stream_id) override;
void SetIsDocked(const DispatchCallback& callback, bool is_docked) override;
void OpenInNewTab(const std::string& url) override;
void SaveToFile(const std::string& url,
const std::string& content,
@ -86,15 +92,22 @@ class InspectableWebContentsImpl :
void RemoveFileSystem(const std::string& file_system_path) override;
void UpgradeDraggedFileSystemPermissions(
const std::string& file_system_url) override;
void IndexPath(int request_id,
void IndexPath(int index_request_id,
const std::string& file_system_path) override;
void StopIndexing(int request_id) override;
void SearchInPath(int request_id,
void StopIndexing(int index_request_id) override;
void SearchInPath(int search_request_id,
const std::string& file_system_path,
const std::string& query) override;
void SetWhitelistedShortcuts(const std::string& message) override;
void ZoomIn() override;
void ZoomOut() override;
void ResetZoom() override;
void SetDevicesUpdatesEnabled(bool enabled) override;
void SendMessageToBrowser(const std::string& message) override;
void RecordActionUMA(const std::string& name, int action) override;
void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
const std::string& url) override;
// content::DevToolsFrontendHostDelegate:
void HandleMessageFromDevToolsFrontend(const std::string& message) override;
@ -109,11 +122,9 @@ class InspectableWebContentsImpl :
// content::WebContentsObserver:
void AboutToNavigateRenderFrame(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
void WebContentsDestroyed() override;
// content::WebContentsDelegate
// content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source,
int32 level,
const base::string16& message,
@ -133,19 +144,30 @@ class InspectableWebContentsImpl :
void CloseContents(content::WebContents* source) override;
void WebContentsFocused(content::WebContents* contents) override;
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;
void SendMessageAck(int request_id,
const base::Value* arg1);
scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<content::WebContents> devtools_web_contents_;
scoped_ptr<InspectableWebContentsView> view_;
bool frontend_loaded_;
scoped_refptr<content::DevToolsAgentHost> agent_host_;
scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
DevToolsContentsResizingStrategy contents_resizing_strategy_;
gfx::Rect devtools_bounds_;
bool can_dock_;
scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
InspectableWebContentsDelegate* delegate_; // weak references.
InspectableWebContentsDelegate* delegate_;
using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>;
PendingRequestsMap pending_requests_;
base::WeakPtrFactory<InspectableWebContentsImpl> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsImpl);
};

View file

@ -17,12 +17,12 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
InspectableWebContentsImpl* inspectable_web_contents_impl);
virtual ~InspectableWebContentsViewMac();
virtual gfx::NativeView GetNativeView() const override;
virtual void ShowDevTools() override;
virtual void CloseDevTools() override;
virtual bool IsDevToolsViewShowing() override;
virtual void SetIsDocked(bool docked) override;
virtual void SetContentsResizingStrategy(
gfx::NativeView GetNativeView() const override;
void ShowDevTools() override;
void CloseDevTools() override;
bool IsDevToolsViewShowing() override;
void SetIsDocked(bool docked) override;
void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy) override;
InspectableWebContentsImpl* inspectable_web_contents() {

View file

@ -30,7 +30,7 @@ static bool UnityIsRunning() {
struct DBusConnection* bus = NULL;
dbus_error_init(&err);
bus = dbus_bus_get(DBUS_BUS_SESSION, &err);
if (dbus_error_is_set(&err)) {
g_debug("Failed to get Session Bus reference");
@ -39,7 +39,7 @@ static bool UnityIsRunning() {
goto out;
}
unity_result = dbus_bus_name_has_owner(bus, "com.canonical.indicator.session", &err);
if (dbus_error_is_set(&err)) {
@ -107,7 +107,8 @@ void NotificationPresenterLinux::ShowNotification(
// Zen Nature" is difficult, we will test for the presence of the indicate
// dbus service
if (!UnityIsRunning()) {
notify_notification_add_action(notification, "default", "View", OnNotificationViewThunk, this, nullptr);
notify_notification_add_action(
notification, "default", "View", OnNotificationViewThunk, this, nullptr);
}
GdkPixbuf* pixbuf = libgtk2ui::GdkPixbufFromSkBitmap(icon);

View file

@ -51,17 +51,17 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
void DisableDeviceEnumerationForTesting();
// Overridden from content::MediaObserver:
virtual void OnAudioCaptureDevicesChanged() override;
virtual void OnVideoCaptureDevicesChanged() override;
virtual void OnMediaRequestStateChanged(
void OnAudioCaptureDevicesChanged() override;
void OnVideoCaptureDevicesChanged() override;
void OnMediaRequestStateChanged(
int render_process_id,
int render_view_id,
int page_request_id,
const GURL& security_origin,
content::MediaStreamType stream_type,
content::MediaRequestState state) override;
virtual void OnCreatingAudioStream(int render_process_id,
int render_view_id) override;
void OnCreatingAudioStream(int render_process_id,
int render_view_id) override;
private:
friend struct DefaultSingletonTraits<MediaCaptureDevicesDispatcher>;

View file

@ -52,8 +52,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
virtual ~URLRequestContextGetter();
// net::URLRequestContextGetter:
virtual net::URLRequestContext* GetURLRequestContext() override;
virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override;
net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override;
net::HostResolver* host_resolver();

View file

@ -24,13 +24,13 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
~InspectableWebContentsViewViews();
// InspectableWebContentsView:
virtual views::View* GetView() override;
virtual views::View* GetWebView() override;
virtual void ShowDevTools() override;
virtual void CloseDevTools() override;
virtual bool IsDevToolsViewShowing() override;
virtual void SetIsDocked(bool docked) override;
virtual void SetContentsResizingStrategy(
views::View* GetView() override;
views::View* GetWebView() override;
void ShowDevTools() override;
void CloseDevTools() override;
bool IsDevToolsViewShowing() override;
void SetIsDocked(bool docked) override;
void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy) override;
InspectableWebContentsImpl* inspectable_web_contents() {
@ -39,7 +39,7 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
private:
// views::View:
virtual void Layout() override;
void Layout() override;
// Owns us.
InspectableWebContentsImpl* inspectable_web_contents_;

View file

@ -17,42 +17,42 @@ class ViewsDelegate : public views::ViewsDelegate {
protected:
// views::ViewsDelegate:
virtual void SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
ui::WindowShowState show_state) override;
virtual bool GetSavedWindowPlacement(
void SaveWindowPlacement(const views::Widget* window,
const std::string& window_name,
const gfx::Rect& bounds,
ui::WindowShowState show_state) override;
bool GetSavedWindowPlacement(
const views::Widget* widget,
const std::string& window_name,
gfx::Rect* bounds,
ui::WindowShowState* show_state) const override;
virtual void NotifyAccessibilityEvent(
void NotifyAccessibilityEvent(
views::View* view, ui::AXEvent event_type) override;
virtual void NotifyMenuItemFocused(const base::string16& menu_name,
const base::string16& menu_item_name,
int item_index,
int item_count,
bool has_submenu) override;
void NotifyMenuItemFocused(const base::string16& menu_name,
const base::string16& menu_item_name,
int item_index,
int item_count,
bool has_submenu) override;
#if defined(OS_WIN)
virtual HICON GetDefaultWindowIcon() const override;
virtual HICON GetSmallWindowIcon() const override;
virtual bool IsWindowInMetro(gfx::NativeWindow window) const override;
HICON GetDefaultWindowIcon() const override;
HICON GetSmallWindowIcon() const override;
bool IsWindowInMetro(gfx::NativeWindow window) const override;
#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
virtual gfx::ImageSkia* GetDefaultWindowIcon() const override;
gfx::ImageSkia* GetDefaultWindowIcon() const override;
#endif
virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
views::NonClientFrameView* CreateDefaultNonClientFrameView(
views::Widget* widget) override;
virtual void AddRef() override;
virtual void ReleaseRef() override;
virtual content::WebContents* CreateWebContents(
void AddRef() override;
void ReleaseRef() override;
content::WebContents* CreateWebContents(
content::BrowserContext* browser_context,
content::SiteInstance* site_instance) override;
virtual void OnBeforeWidgetInit(
void OnBeforeWidgetInit(
views::Widget::InitParams* params,
views::internal::NativeWidgetDelegate* delegate) override;
virtual base::TimeDelta GetDefaultTextfieldObscuredRevealDuration() override;
virtual bool WindowManagerProvidesTitleBar(bool maximized) override;
base::TimeDelta GetDefaultTextfieldObscuredRevealDuration() override;
bool WindowManagerProvidesTitleBar(bool maximized) override;
private:
DISALLOW_COPY_AND_ASSIGN(ViewsDelegate);

View file

@ -18,13 +18,13 @@ class WebUIControllerFactory : public content::WebUIControllerFactory {
explicit WebUIControllerFactory(BrowserContext* browser_context);
virtual ~WebUIControllerFactory();
virtual content::WebUI::TypeID GetWebUIType(
content::WebUI::TypeID GetWebUIType(
content::BrowserContext* browser_context, const GURL& url) const override;
virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
bool UseWebUIForURL(content::BrowserContext* browser_context,
const GURL& url) const override;
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
const GURL& url) const override;
virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
const GURL& url) const override;
virtual content::WebUIController* CreateWebUIControllerForURL(
content::WebUIController* CreateWebUIControllerForURL(
content::WebUI* web_ui,
const GURL& url) const override;

View file

@ -49,11 +49,11 @@ class MainDelegate : public content::ContentMainDelegate {
virtual void OverrideFrameworkBundlePath();
#endif
virtual bool BasicStartupComplete(int* exit_code) override;
virtual void PreSandboxStartup() override;
bool BasicStartupComplete(int* exit_code) override;
void PreSandboxStartup() override;
private:
virtual content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
void InitializeResourceBundle();

@ -1 +1 @@
Subproject commit 8025f5495c04f1cf9e0d65a0aaa97b58c304faf7
Subproject commit ba88c8a53f1b563c43fc063cc048e5efdc238c18