namespace mate {
template<>
-struct Converter<base::trace_event::CategoryFilter> {
+struct Converter<base::trace_event::TraceConfig> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
- base::trace_event::CategoryFilter* out) {
- std::string filter;
- if (!ConvertFromV8(isolate, val, &filter))
- return false;
- *out = base::trace_event::CategoryFilter(filter);
- return true;
- }
-};
-
-template<>
-struct Converter<base::trace_event::TraceOptions> {
- static bool FromV8(v8::Isolate* isolate,
- v8::Local<v8::Value> val,
- base::trace_event::TraceOptions* out) {
- std::string options;
+ base::trace_event::TraceConfig* out) {
+ Dictionary options;
if (!ConvertFromV8(isolate, val, &options))
return false;
- return out->SetFromString(options);
+ std::string category_filter, trace_options;
+ if (!options.Get("categoryFilter", &category_filter) ||
+ !options.Get("traceOptions", &trace_options))
+ return false;
+ *out = base::trace_event::TraceConfig(category_filter, trace_options);
+ return true;
}
};
int route_id,
int main_frame_route_id,
WindowContainerType window_container_type,
- const base::string16& frame_name,
+ const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
- const base::string16& error_description) {
+ const base::string16& error_description,
+ bool was_ignored_by_handler) {
Emit("did-fail-load", error_code, error_description);
}
void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
- const base::string16& error_description) {
+ const base::string16& error_description,
+ bool was_ignored_by_handler) {
Emit("did-fail-load", error_code, error_description);
}
int route_id,
int main_frame_route_id,
WindowContainerType window_container_type,
- const base::string16& frame_name,
+ const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
void DidFailLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
- const base::string16& error_description) override;
+ const base::string16& error_description,
+ bool was_ignored_by_handler) override;
void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
- const base::string16& error_description) override;
+ const base::string16& error_description,
+ bool was_ignored_by_handler) override;
void DidStartLoading() override;
void DidStopLoading() override;
void DidGetResourceResponseStart(
void OnWindowAllClosed() override;
// Observers of the browser.
- ObserverList<BrowserObserver> observers_;
+ base::ObserverList<BrowserObserver> observers_;
// Whether "ready" event has been emitted.
bool is_ready_;
brightray::InspectableWebContents* inspectable_web_contents_;
// Observers of this window.
- ObserverList<NativeWindowObserver> observers_;
+ base::ObserverList<NativeWindowObserver> observers_;
base::WeakPtrFactory<NativeWindow> weak_factory_;
net::Filter* URLRequestAsarJob::SetupFilter() const {
// Bug 9936 - .svgz files needs to be decompressed.
- return LowerCaseEqualsASCII(file_path_.Extension(), ".svgz")
+ return base::LowerCaseEqualsASCII(file_path_.Extension(), ".svgz")
? net::Filter::GZipFactory() : NULL;
}
}
if (type_ == TYPE_ASAR) {
- int rv = stream_->Seek(base::File::FROM_BEGIN,
- file_info_.offset,
+ int rv = stream_->Seek(file_info_.offset,
base::Bind(&URLRequestAsarJob::DidSeek,
weak_ptr_factory_.GetWeakPtr()));
if (rv != net::ERR_IO_PENDING) {
byte_range_.first_byte_position() + 1;
if (remaining_bytes_ > 0 && byte_range_.first_byte_position() != 0) {
- int rv = stream_->Seek(base::File::FROM_BEGIN,
- byte_range_.first_byte_position(),
+ int rv = stream_->Seek(byte_range_.first_byte_position(),
base::Bind(&URLRequestAsarJob::DidSeek,
weak_ptr_factory_.GetWeakPtr()));
if (rv != net::ERR_IO_PENDING) {
// Convert string to RequestType.
net::URLFetcher::RequestType GetRequestType(const std::string& raw) {
- std::string method = StringToUpperASCII(raw);
+ std::string method = base::StringToUpperASCII(raw);
if (method.empty() || method == "GET")
return net::URLFetcher::GET;
else if (method == "POST")
Delegate* delegate_; // weak ref.
std::map<int, base::string16> roles_;
- ObserverList<Observer> observers_;
+ base::ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(AtomMenuModel);
};
TrayIcon();
private:
- ObserverList<TrayIconObserver> observers_;
+ base::ObserverList<TrayIconObserver> observers_;
DISALLOW_COPY_AND_ASSIGN(TrayIcon);
};
namespace atom {
// static
-base::LazyInstance<ObserverList<WindowListObserver>>::Leaky
+base::LazyInstance<base::ObserverList<WindowListObserver>>::Leaky
WindowList::observers_ = LAZY_INSTANCE_INITIALIZER;
// static
// A list of observers which will be notified of every window addition and
// removal across all WindowLists.
- static base::LazyInstance<ObserverList<WindowListObserver>>::Leaky observers_;
+ static base::LazyInstance<base::ObserverList<WindowListObserver>>::Leaky
+ observers_;
static WindowList* instance_;
#include "atom/common/node_includes.h"
#include "base/base64.h"
#include "base/strings/string_util.h"
+#include "base/strings/pattern.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/base/data_url.h"
// We don't try to convert string to float here because it is very very
// expensive.
for (unsigned i = 0; i < arraysize(kScaleFactorPairs); ++i) {
- if (EndsWith(filename, kScaleFactorPairs[i].name, true))
+ if (base::EndsWith(filename, kScaleFactorPairs[i].name, true))
return kScaleFactorPairs[i].scale;
}
const base::FilePath& path) {
bool succeed = false;
std::string filename(path.BaseName().RemoveExtension().AsUTF8Unsafe());
- if (MatchPattern(filename, "*@*x"))
+ if (base::MatchPattern(filename, "*@*x"))
// Don't search for other representations if the DPI has been specified.
return AddImageSkiaRep(image, path, GetScaleFactorFromPath(path));
else
#if defined(OS_MACOSX)
bool IsTemplateFilename(const base::FilePath& path) {
- return (MatchPattern(path.value(), "*Template.*") ||
- MatchPattern(path.value(), "*Template@*x.*"));
+ return (base::MatchPattern(path.value(), "*Template.*") ||
+ base::MatchPattern(path.value(), "*Template@*x.*"));
}
#endif
}
uint32 size;
- if (!PickleIterator(Pickle(buf.data(), buf.size())).ReadUInt32(&size)) {
+ if (!base::PickleIterator(base::Pickle(buf.data(), buf.size())).ReadUInt32(
+ &size)) {
LOG(ERROR) << "Failed to parse header size from " << path_.value();
return false;
}
}
std::string header;
- if (!PickleIterator(Pickle(buf.data(), buf.size())).ReadString(&header)) {
+ if (!base::PickleIterator(base::Pickle(buf.data(), buf.size())).ReadString(
+ &header)) {
LOG(ERROR) << "Failed to parse header from " << path_.value();
return false;
}
#include "third_party/WebKit/public/web/WebPluginParams.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
-#include "third_party/WebKit/Source/wtf/ArrayBufferContents.h"
#include "atom/common/node_includes.h"
node_bindings_->LoadEnvironment(env);
}
-bool AtomRendererClient::ShouldFork(blink::WebFrame* frame,
+bool AtomRendererClient::ShouldFork(blink::WebLocalFrame* frame,
const GURL& url,
const std::string& http_method,
bool is_initial_navigation,
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params,
blink::WebPlugin** plugin) override;
- bool ShouldFork(blink::WebFrame* frame,
+ bool ShouldFork(blink::WebLocalFrame* frame,
const GURL& url,
const std::string& http_method,
bool is_initial_navigation,
#include <map>
+#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/message_loop/message_loop.h"
#include "ui/gfx/geometry/size.h"
namespace atom {
} // namespace
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame)
- : render_frame_(render_frame) {
+ : render_frame_(render_frame),
+ weak_ptr_factory_(this) {
}
GuestViewContainer::~GuestViewContainer() {
FROM_HERE, base::Bind(element_resize_callback_, new_size));
}
+base::WeakPtr<content::BrowserPluginDelegate> GuestViewContainer::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
} // namespace atom
// content::BrowserPluginDelegate:
void SetElementInstanceID(int element_instance_id) final;
void DidResizeElement(const gfx::Size& new_size) final;
+ base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final;
private:
int element_instance_id_;
ResizeCallback element_resize_callback_;
+ base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
};
// assume all data that is placed on the clipboard is UTF16 and pepper allows
// arbitrary data so this change would require some reworking of the chrome
// clipboard interface for custom data.
-bool JumpToFormatInPickle(const base::string16& format, PickleIterator* iter) {
+bool JumpToFormatInPickle(const base::string16& format,
+ base::PickleIterator* iter) {
size_t size = 0;
if (!iter->ReadSizeT(&size))
return false;
}
bool IsFormatAvailableInPickle(const base::string16& format,
- const Pickle& pickle) {
- PickleIterator iter(pickle);
+ const base::Pickle& pickle) {
+ base::PickleIterator iter(pickle);
return JumpToFormatInPickle(format, &iter);
}
std::string ReadDataFromPickle(const base::string16& format,
- const Pickle& pickle) {
+ const base::Pickle& pickle) {
std::string result;
- PickleIterator iter(pickle);
+ base::PickleIterator iter(pickle);
if (!JumpToFormatInPickle(format, &iter) || !iter.ReadString(&result))
return std::string();
return result;
}
bool WriteDataToPickle(const std::map<base::string16, std::string>& data,
- Pickle* pickle) {
+ base::Pickle* pickle) {
pickle->WriteSizeT(data.size());
for (std::map<base::string16, std::string>::const_iterator it = data.begin();
it != data.end();
std::string clipboard_data;
clipboard->ReadData(ui::Clipboard::GetPepperCustomDataFormatType(),
&clipboard_data);
- Pickle pickle(clipboard_data.data(), clipboard_data.size());
+ base::Pickle pickle(clipboard_data.data(), clipboard_data.size());
available =
IsFormatAvailableInPickle(base::UTF8ToUTF16(format_name), pickle);
}
std::string clipboard_data;
clipboard->ReadData(ui::Clipboard::GetPepperCustomDataFormatType(),
&clipboard_data);
- Pickle pickle(clipboard_data.data(), clipboard_data.size());
+ base::Pickle pickle(clipboard_data.data(), clipboard_data.size());
if (IsFormatAvailableInPickle(format_name, pickle)) {
result = PP_OK;
clipboard_string = ReadDataFromPickle(format_name, pickle);
}
if (custom_data_map.size() > 0) {
- Pickle pickle;
+ base::Pickle pickle;
if (WriteDataToPickle(custom_data_map, &pickle)) {
scw.WritePickledData(pickle,
ui::Clipboard::GetPepperCustomDataFormatType());
->GetVarTracker()
->TrackSharedMemoryHandle(instance, host_shm_handle, size);
- base::PlatformFile host_handle =
-#if defined(OS_WIN)
- host_shm_handle;
-#elif defined(OS_POSIX)
- host_shm_handle.fd;
-#else
-#error Not implemented.
-#endif
// We set auto_close to false since we need our file descriptor to
// actually be duplicated on linux. The shared memory destructor will
// close the original handle for us.
- plugin_handle->set_shmem(host_->ShareHandleWithRemote(host_handle, false),
- size);
+ plugin_handle->set_shmem(
+ host_->ShareSharedMemoryHandleWithRemote(host_shm_handle), size);
}
// blink::WebFrameClient override:
virtual blink::WebFrame* createChildFrame(
blink::WebLocalFrame* parent,
+ blink::WebTreeScopeType scope,
const blink::WebString& name,
blink::WebSandboxFlags sandboxFlags);
- virtual void frameDetached(blink::WebFrame* frame);
+ virtual void frameDetached(blink::WebFrame* frame, DetachType type);
private:
void CallOnReady();
blink::WebView* web_view = blink::WebView::create(this);
owns_web_view_ = true;
content::RenderView::ApplyWebPreferences(prefs, web_view);
- web_view->setMainFrame(blink::WebLocalFrame::create(this));
+ web_view->setMainFrame(
+ blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this));
frame_.Reset(web_view->mainFrame()->toWebLocalFrame());
node_to_print_.reset();
blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
blink::WebLocalFrame* parent,
+ blink::WebTreeScopeType scope,
const blink::WebString& name,
blink::WebSandboxFlags sandboxFlags) {
- blink::WebFrame* frame = blink::WebLocalFrame::create(this);
+ blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this);
parent->appendChild(frame);
return frame;
}
-void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) {
+void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame,
+ DetachType type) {
+ DCHECK(type == DetachType::Remove);
if (frame->parent())
frame->parent()->removeChild(frame);
frame->close();
Once all child processes have acknowledged the `getCategories` request the
`callback` is invoked with an array of category groups.
-### `contentTracing.startRecording(categoryFilter, traceOptions, callback)`
+### `contentTracing.startRecording(options, callback)`
-* `categoryFilter` String
-* `traceOptions` String
+* `options` Object
+ * `categoryFilter` String
+ * `traceOptions` String
* `callback` Function
Start recording on all processes.
temporary file. The actual file path will be passed to `callback` if it's not
`null`.
-### `contentTracing.startMonitoring(categoryFilter, traceOptions, callback)`
+### `contentTracing.startMonitoring(options, callback)`
-* `categoryFilter` String
-* `traceOptions` String
+* `options` Object
+ * `categoryFilter` String
+ * `traceOptions` String
* `callback` Function
Start monitoring on all processes.