#endif // !defined(OS_WIN)
// Only enable logging when --enable-logging is specified.
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
if (!command_line->HasSwitch(switches::kEnableLogging) &&
!env->HasVar("ELECTRON_ENABLE_LOGGING")) {
settings.logging_dest = logging::LOG_NONE;
brightray::MainDelegate::PreSandboxStartup();
// Set google API key.
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
if (!env->HasVar("GOOGLE_API_KEY"))
env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY);
return utility_client_.get();
}
-scoped_ptr<brightray::ContentClient> AtomMainDelegate::CreateContentClient() {
- return scoped_ptr<brightray::ContentClient>(new AtomContentClient);
+std::unique_ptr<brightray::ContentClient> AtomMainDelegate::CreateContentClient() {
+ return std::unique_ptr<brightray::ContentClient>(new AtomContentClient);
}
} // namespace atom
content::ContentUtilityClient* CreateContentUtilityClient() override;
// brightray::MainDelegate:
- scoped_ptr<brightray::ContentClient> CreateContentClient() override;
+ std::unique_ptr<brightray::ContentClient> CreateContentClient() override;
#if defined(OS_MACOSX)
void OverrideChildProcessPath() override;
void OverrideFrameworkBundlePath() override;
#endif
brightray::ContentClient content_client_;
- scoped_ptr<content::ContentBrowserClient> browser_client_;
- scoped_ptr<content::ContentRendererClient> renderer_client_;
- scoped_ptr<content::ContentUtilityClient> utility_client_;
+ std::unique_ptr<content::ContentBrowserClient> browser_client_;
+ std::unique_ptr<content::ContentRendererClient> renderer_client_;
+ std::unique_ptr<content::ContentUtilityClient> utility_client_;
DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
};
void App::SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- scoped_ptr<content::ClientCertificateDelegate> delegate) {
+ std::unique_ptr<content::ClientCertificateDelegate> delegate) {
std::shared_ptr<content::ClientCertificateDelegate>
shared_delegate(delegate.release());
bool prevent_default =
void App::SetDesktopName(const std::string& desktop_name) {
#if defined(OS_LINUX)
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
env->SetVar("CHROME_DESKTOP", desktop_name);
#endif
}
const net::CompletionCallback& callback) {
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
if (!certificate_manager_model_) {
- scoped_ptr<base::DictionaryValue> copy = options.CreateDeepCopy();
+ std::unique_ptr<base::DictionaryValue> copy = options.CreateDeepCopy();
CertificateManagerModel::Create(browser_context,
base::Bind(&App::OnCertificateManagerModelCreated,
base::Unretained(this),
}
void App::OnCertificateManagerModelCreated(
- scoped_ptr<base::DictionaryValue> options,
+ std::unique_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
- scoped_ptr<CertificateManagerModel> model) {
+ std::unique_ptr<CertificateManagerModel> model) {
certificate_manager_model_ = std::move(model);
int rv = ImportIntoCertStore(certificate_manager_model_.get(),
*(options.get()));
#if defined(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(
- scoped_ptr<base::DictionaryValue> options,
+ std::unique_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
- scoped_ptr<CertificateManagerModel> model);
+ std::unique_ptr<CertificateManagerModel> model);
#endif
protected:
void SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- scoped_ptr<content::ClientCertificateDelegate> delegate) override;
+ std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
// content::GpuDataManagerObserver:
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
const net::CompletionCallback& callback);
#endif
- scoped_ptr<ProcessSingleton> process_singleton_;
+ std::unique_ptr<ProcessSingleton> process_singleton_;
#if defined(USE_NSS_CERTS)
- scoped_ptr<CertificateManagerModel> certificate_manager_model_;
+ std::unique_ptr<CertificateManagerModel> certificate_manager_model_;
#endif
DISALLOW_COPY_AND_ASSIGN(App);
}
// Remove cookies from |list| not matching |filter|, and pass it to |callback|.
-void FilterCookies(scoped_ptr<base::DictionaryValue> filter,
+void FilterCookies(std::unique_ptr<base::DictionaryValue> filter,
const Cookies::GetCallback& callback,
const net::CookieList& list) {
net::CookieList result;
// Receives cookies matching |filter| in IO thread.
void GetCookiesOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
- scoped_ptr<base::DictionaryValue> filter,
+ std::unique_ptr<base::DictionaryValue> filter,
const Cookies::GetCallback& callback) {
std::string url;
filter->GetString("url", &url);
// Sets cookie with |details| in IO thread.
void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
- scoped_ptr<base::DictionaryValue> details,
+ std::unique_ptr<base::DictionaryValue> details,
const Cookies::SetCallback& callback) {
std::string url, name, value, domain, path;
bool secure = false;
GetCookieStore(getter)->SetCookieWithDetailsAsync(
GURL(url), name, value, domain, path, creation_time,
expiration_time, last_access_time, secure, http_only,
- false, false, net::COOKIE_PRIORITY_DEFAULT,
- base::Bind(OnSetCookie, callback));
+ net::CookieSameSite::DEFAULT_MODE, false,
+ net::COOKIE_PRIORITY_DEFAULT, base::Bind(OnSetCookie, callback));
}
} // namespace
void Cookies::Get(const base::DictionaryValue& filter,
const GetCallback& callback) {
- scoped_ptr<base::DictionaryValue> copied(filter.CreateDeepCopy());
+ std::unique_ptr<base::DictionaryValue> copied(filter.CreateDeepCopy());
auto getter = make_scoped_refptr(request_context_getter_);
content::BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
void Cookies::Set(const base::DictionaryValue& details,
const SetCallback& callback) {
- scoped_ptr<base::DictionaryValue> copied(details.CreateDeepCopy());
+ std::unique_ptr<base::DictionaryValue> copied(details.CreateDeepCopy());
auto getter = make_scoped_refptr(request_context_getter_);
content::BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
const std::string& message) {
DCHECK(agent_host == agent_host_.get());
- scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
+ std::unique_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
if (!parsed_message->IsType(base::Value::TYPE_DICTIONARY))
return;
options.set_disable_effects(false);
#endif
- scoped_ptr<webrtc::ScreenCapturer> screen_capturer(
+ std::unique_ptr<webrtc::ScreenCapturer> screen_capturer(
capture_screen ? webrtc::ScreenCapturer::Create(options) : nullptr);
- scoped_ptr<webrtc::WindowCapturer> window_capturer(
+ std::unique_ptr<webrtc::WindowCapturer> window_capturer(
capture_window ? webrtc::WindowCapturer::Create(options) : nullptr);
media_list_.reset(new NativeDesktopMediaList(
std::move(screen_capturer), std::move(window_capturer)));
bool OnRefreshFinished() override;
private:
- scoped_ptr<DesktopMediaList> media_list_;
+ std::unique_ptr<DesktopMediaList> media_list_;
DISALLOW_COPY_AND_ASSIGN(DesktopCapturer);
};
int x = -1, int y = -1,
int positioning_item = 0) = 0;
- scoped_ptr<AtomMenuModel> model_;
+ std::unique_ptr<AtomMenuModel> model_;
Menu* parent_;
private:
}
if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) {
- scoped_ptr<content::PowerSaveBlocker> new_blocker =
+ std::unique_ptr<content::PowerSaveBlocker> new_blocker =
content::PowerSaveBlocker::Create(
new_blocker_type,
content::PowerSaveBlocker::kReasonOther,
bool Stop(int id);
bool IsStarted(int id);
- scoped_ptr<content::PowerSaveBlocker> power_save_blocker_;
+ std::unique_ptr<content::PowerSaveBlocker> power_save_blocker_;
// Currnet blocker type used by |power_save_blocker_|
content::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_;
const Handler& handler) {
if (job_factory_->IsHandledProtocol(scheme))
return PROTOCOL_REGISTERED;
- scoped_ptr<CustomProtocolHandler<RequestJob>> protocol_handler(
+ std::unique_ptr<CustomProtocolHandler<RequestJob>> protocol_handler(
new CustomProtocolHandler<RequestJob>(
isolate(), request_context_getter_, handler));
if (job_factory_->SetProtocolHandler(scheme, std::move(protocol_handler)))
return PROTOCOL_FAIL;
if (ContainsKey(original_protocols_, scheme))
return PROTOCOL_INTERCEPTED;
- scoped_ptr<CustomProtocolHandler<RequestJob>> protocol_handler(
+ std::unique_ptr<CustomProtocolHandler<RequestJob>> protocol_handler(
new CustomProtocolHandler<RequestJob>(
isolate(), request_context_getter_, handler));
original_protocols_.set(
// Map that stores the original protocols of schemes.
using OriginalProtocolsMap = base::ScopedPtrHashMap<
std::string,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>>;
+ std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>>;
OriginalProtocolsMap original_protocols_;
AtomURLRequestJobFactory* job_factory_; // weak ref
}
void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
- scoped_ptr<brightray::DevToolsNetworkConditions> conditions;
+ std::unique_ptr<brightray::DevToolsNetworkConditions> conditions;
bool offline = false;
double latency, download_throughput, upload_throughput;
if (options.Get("offline", &offline) && offline) {
}
void Session::DisableNetworkEmulation() {
- scoped_ptr<brightray::DevToolsNetworkConditions> conditions;
+ std::unique_ptr<brightray::DevToolsNetworkConditions> conditions;
browser_context_->network_controller_handle()->SetNetworkState(
devtools_network_emulation_client_id_, std::move(conditions));
browser_context_->network_delegate()->SetDevToolsNetworkEmulationClientId(
object:nil
queue:nil
usingBlock:^(NSNotification* notification) {
- scoped_ptr<base::DictionaryValue> user_info =
+ std::unique_ptr<base::DictionaryValue> user_info =
NSDictionaryToDictionaryValue(notification.userInfo);
if (user_info) {
copied_callback.Run(
v8::Local<v8::Object> ModifiersToObject(v8::Isolate* isolate, int modifiers);
v8::Global<v8::Object> menu_;
- scoped_ptr<TrayIcon> tray_icon_;
+ std::unique_ptr<TrayIcon> tray_icon_;
DISALLOW_COPY_AND_ASSIGN(Tray);
};
if (response_headers.GetList(key, &values))
values->AppendString(value);
} else {
- scoped_ptr<base::ListValue> values(new base::ListValue());
+ std::unique_ptr<base::ListValue> values(new base::ListValue());
values->AppendString(value);
response_headers.Set(key, std::move(values));
}
const FrameSubscriber::FrameCaptureCallback& callback) {
const auto view = web_contents()->GetRenderWidgetHostView();
if (view) {
- scoped_ptr<FrameSubscriber> frame_subscriber(new FrameSubscriber(
+ std::unique_ptr<FrameSubscriber> frame_subscriber(new FrameSubscriber(
isolate(), view, callback));
view->BeginFrameSubscription(std::move(frame_subscriber));
}
v8::Global<v8::Value> devtools_web_contents_;
v8::Global<v8::Value> debugger_;
- scoped_ptr<WebViewGuestDelegate> guest_delegate_;
+ std::unique_ptr<WebViewGuestDelegate> guest_delegate_;
// The host webcontents that may contain this webcontents.
WebContents* embedder_;
api::WebContents* api_web_contents_;
- scoped_ptr<NativeWindow> window_;
+ std::unique_ptr<NativeWindow> window_;
DISALLOW_COPY_AND_ASSIGN(Window);
};
private:
static int32_t next_id_;
- static scoped_ptr<atom::KeyWeakMap<int32_t>> weak_map_;
+ static std::unique_ptr<atom::KeyWeakMap<int32_t>> weak_map_;
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
};
int32_t TrackableObject<T>::next_id_ = 0;
template<typename T>
-scoped_ptr<atom::KeyWeakMap<int32_t>> TrackableObject<T>::weak_map_;
+std::unique_ptr<atom::KeyWeakMap<int32_t>> TrackableObject<T>::weak_map_;
} // namespace mate
void AtomBrowserClient::SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- scoped_ptr<content::ClientCertificateDelegate> delegate) {
+ std::unique_ptr<content::ClientCertificateDelegate> delegate) {
if (!cert_request_info->client_certs.empty() && delegate_) {
delegate_->SelectClientCertificate(
web_contents, cert_request_info, std::move(delegate));
void SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- scoped_ptr<content::ClientCertificateDelegate> delegate) override;
+ std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override;
bool CanCreateWindow(const GURL& opener_url,
const GURL& opener_top_level_frame_url,
// pending_render_process => current_render_process.
std::map<int, int> pending_processes_;
- scoped_ptr<AtomResourceDispatcherHostDelegate>
+ std::unique_ptr<AtomResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
Delegate* delegate_;
class NoCacheBackend : public net::HttpCache::BackendFactory {
int CreateBackend(net::NetLog* net_log,
- scoped_ptr<disk_cache::Backend>* backend,
+ std::unique_ptr<disk_cache::Backend>* backend,
const net::CompletionCallback& callback) override {
return net::ERR_FAILED;
}
return content::BuildUserAgentFromProduct(user_agent);
}
-scoped_ptr<net::URLRequestJobFactory>
+std::unique_ptr<net::URLRequestJobFactory>
AtomBrowserContext::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) {
- scoped_ptr<AtomURLRequestJobFactory> job_factory(job_factory_);
+ std::unique_ptr<AtomURLRequestJobFactory> job_factory(job_factory_);
for (auto& it : *handlers) {
job_factory->SetProtocolHandler(it.first,
new net::FtpNetworkLayer(host_resolver))));
// Set up interceptors in the reverse order.
- scoped_ptr<net::URLRequestJobFactory> top_job_factory =
+ std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
std::move(job_factory);
content::URLRequestInterceptorScopedVector::reverse_iterator it;
for (it = interceptors->rbegin(); it != interceptors->rend(); ++it)
return permission_manager_.get();
}
-scoped_ptr<net::CertVerifier> AtomBrowserContext::CreateCertVerifier() {
+std::unique_ptr<net::CertVerifier> AtomBrowserContext::CreateCertVerifier() {
return make_scoped_ptr(cert_verifier_);
}
// brightray::URLRequestContextGetter::Delegate:
net::NetworkDelegate* CreateNetworkDelegate() override;
std::string GetUserAgent() override;
- scoped_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
+ std::unique_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers,
content::URLRequestInterceptorScopedVector* interceptors) override;
net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path) override;
- scoped_ptr<net::CertVerifier> CreateCertVerifier() override;
+ std::unique_ptr<net::CertVerifier> CreateCertVerifier() override;
net::SSLConfigService* CreateSSLConfigService() override;
bool AllowNTLMCredentialsForDomain(const GURL& auth_origin) override;
AtomNetworkDelegate* network_delegate() const { return network_delegate_; }
private:
- scoped_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
- scoped_ptr<WebViewManager> guest_manager_;
- scoped_ptr<AtomPermissionManager> permission_manager_;
+ std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
+ std::unique_ptr<WebViewManager> guest_manager_;
+ std::unique_ptr<AtomPermissionManager> permission_manager_;
// Managed by brightray::BrowserContext.
AtomCertVerifier* cert_verifier_;
#endif
// A fake BrowserProcess object that used to feed the source code from chrome.
- scoped_ptr<BrowserProcess> fake_browser_process_;
+ std::unique_ptr<BrowserProcess> fake_browser_process_;
// The gin::PerIsolateData requires a task runner to create, so we feed it
// with a task runner that will post all work to main loop.
// Pointer to exit code.
int* exit_code_;
- scoped_ptr<Browser> browser_;
- scoped_ptr<JavascriptEnvironment> js_env_;
- scoped_ptr<NodeBindings> node_bindings_;
- scoped_ptr<AtomBindings> atom_bindings_;
- scoped_ptr<NodeDebugger> node_debugger_;
+ std::unique_ptr<Browser> browser_;
+ std::unique_ptr<JavascriptEnvironment> js_env_;
+ std::unique_ptr<NodeBindings> node_bindings_;
+ std::unique_ptr<AtomBindings> atom_bindings_;
+ std::unique_ptr<NodeDebugger> node_debugger_;
base::Timer gc_timer_;
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
- const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents,
- const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) {
- bool prevent_reload = message_text.empty() ||
- message_text == base::ASCIIToUTF16("false");
- callback.Run(!prevent_reload, message_text);
+ // FIXME(zcbenz): the |message_text| is removed, figure out what should we do.
+ callback.Run(true);
}
} // namespace atom
void RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
- const std::string& accept_lang,
content::JavaScriptMessageType javascript_message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
bool* did_suppress_message) override;
void RunBeforeUnloadDialog(
content::WebContents* web_contents,
- const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) override;
void CancelActiveAndPendingDialogs(
if (handler.is_null() && !pending_requests_.empty()) {
for (const auto& request : pending_requests_) {
if (!WebContentsDestroyed(request.second.render_process_id))
- request.second.callback.Run(content::PermissionStatus::DENIED);
+ request.second.callback.Run(blink::mojom::PermissionStatus::DENIED);
}
pending_requests_.clear();
}
return request_id_;
}
- response_callback.Run(content::PermissionStatus::GRANTED);
+ response_callback.Run(blink::mojom::PermissionStatus::GRANTED);
return kNoPendingOperation;
}
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const base::Callback<void(
- const std::vector<content::PermissionStatus>&)>& callback) {
+ const std::vector<blink::mojom::PermissionStatus>&)>& callback) {
// FIXME(zcbenz): Just ignore multiple permissions request for now.
- std::vector<content::PermissionStatus> permissionStatuses;
+ std::vector<blink::mojom::PermissionStatus> permissionStatuses;
for (auto permission : permissions) {
if (permission == content::PermissionType::MIDI_SYSEX) {
content::ChildProcessSecurityPolicy::GetInstance()->
GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID());
}
- permissionStatuses.push_back(content::PermissionStatus::GRANTED);
+ permissionStatuses.push_back(blink::mojom::PermissionStatus::GRANTED);
}
callback.Run(permissionStatuses);
return kNoPendingOperation;
int request_id,
const GURL& origin,
const ResponseCallback& callback,
- content::PermissionStatus status) {
+ blink::mojom::PermissionStatus status) {
auto request = pending_requests_.find(request_id);
if (request != pending_requests_.end()) {
if (!WebContentsDestroyed(request->second.render_process_id))
auto request = pending_requests_.find(request_id);
if (request != pending_requests_.end()) {
if (!WebContentsDestroyed(request->second.render_process_id))
- request->second.callback.Run(content::PermissionStatus::DENIED);
+ request->second.callback.Run(blink::mojom::PermissionStatus::DENIED);
pending_requests_.erase(request);
}
}
const GURL& embedding_origin) {
}
-content::PermissionStatus AtomPermissionManager::GetPermissionStatus(
+blink::mojom::PermissionStatus AtomPermissionManager::GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
- return content::PermissionStatus::GRANTED;
+ return blink::mojom::PermissionStatus::GRANTED;
}
void AtomPermissionManager::RegisterPermissionUsage(
~AtomPermissionManager() override;
using ResponseCallback =
- base::Callback<void(content::PermissionStatus)>;
+ base::Callback<void(blink::mojom::PermissionStatus)>;
using RequestHandler =
base::Callback<void(content::WebContents*,
content::PermissionType,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const base::Callback<void(
- const std::vector<content::PermissionStatus>&)>& callback) override;
+ const std::vector<blink::mojom::PermissionStatus>&)>& callback) override;
protected:
void OnPermissionResponse(int request_id,
const GURL& url,
const ResponseCallback& callback,
- content::PermissionStatus status);
+ blink::mojom::PermissionStatus status);
// content::PermissionManager:
void CancelPermissionRequest(int request_id) override;
void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
- content::PermissionStatus GetPermissionStatus(
+ blink::mojom::PermissionStatus GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin,
- const base::Callback<void(content::PermissionStatus)>& callback) override;
+ const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
+ override;
void UnsubscribePermissionStatusChange(int subscription_id) override;
private:
friend class content::WebContentsUserData<AtomSecurityStateModelClient>;
content::WebContents* web_contents_;
- scoped_ptr<security_state::SecurityStateModel> security_state_model_;
+ std::unique_ptr<security_state::SecurityStateModel> security_state_model_;
DISALLOW_COPY_AND_ASSIGN(AtomSecurityStateModelClient);
};
std::string Browser::GetExecutableFileVersion() const {
base::FilePath path;
if (PathService::Get(base::FILE_EXE, &path)) {
- scoped_ptr<FileVersionInfo> version_info(
+ std::unique_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path));
return base::UTF16ToUTF8(version_info->product_version());
}
std::string Browser::GetExecutableFileProductName() const {
base::FilePath path;
if (PathService::Get(base::FILE_EXE, &path)) {
- scoped_ptr<FileVersionInfo> version_info(
+ std::unique_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(path));
return base::UTF16ToUTF8(version_info->product_name());
}
FileSystem file_system = CreateFileSystemStruct(GetDevToolsWebContents(),
file_system_id,
path.AsUTF8Unsafe());
- scoped_ptr<base::DictionaryValue> file_system_value(
+ std::unique_ptr<base::DictionaryValue> file_system_value(
CreateFileSystemValue(file_system));
auto pref_service = GetPrefService(GetDevToolsWebContents());
// Whether window is fullscreened by window api.
bool native_fullscreen_;
- scoped_ptr<WebDialogHelper> web_dialog_helper_;
- scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
+ std::unique_ptr<WebDialogHelper> web_dialog_helper_;
+ std::unique_ptr<AtomJavaScriptDialogManager> dialog_manager_;
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;
// Make sure BrowserContext is alwasys destroyed after WebContents.
// Notice that web_contents_ must be placed after dialog_manager_, so we can
// make sure web_contents_ is destroyed before dialog_manager_, otherwise a
// crash would happen.
- scoped_ptr<brightray::InspectableWebContents> web_contents_;
+ std::unique_ptr<brightray::InspectableWebContents> web_contents_;
// Maps url to file path, used by the file requests sent from devtools.
typedef std::map<std::string, base::FilePath> PathsMap;
continueUserActivity:(NSUserActivity*)userActivity
restorationHandler:(void (^)(NSArray*restorableObjects))restorationHandler {
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
- scoped_ptr<base::DictionaryValue> user_info =
+ std::unique_ptr<base::DictionaryValue> user_info =
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
if (!user_info)
return NO;
NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value);
-scoped_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
+std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
NSDictionary* dict);
} // namespace atom
namespace {
-scoped_ptr<base::ListValue> NSArrayToListValue(NSArray* arr) {
+std::unique_ptr<base::ListValue> NSArrayToListValue(NSArray* arr) {
if (!arr)
return nullptr;
- scoped_ptr<base::ListValue> result(new base::ListValue);
+ std::unique_ptr<base::ListValue> result(new base::ListValue);
for (id value in arr) {
if ([value isKindOfClass:[NSString class]]) {
result->AppendString(base::SysNSStringToUTF8(value));
else
result->AppendInteger([value intValue]);
} else if ([value isKindOfClass:[NSArray class]]) {
- scoped_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
+ std::unique_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
if (sub_arr)
result->Append(std::move(sub_arr));
else
result->Append(base::Value::CreateNullValue());
} else if ([value isKindOfClass:[NSDictionary class]]) {
- scoped_ptr<base::DictionaryValue> sub_dict =
+ std::unique_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value);
if (sub_dict)
result->Append(std::move(sub_dict));
return obj;
}
-scoped_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
+std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
NSDictionary* dict) {
if (!dict)
return nullptr;
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
for (id key in dict) {
std::string str_key = base::SysNSStringToUTF8(
[key isKindOfClass:[NSString class]] ? key : [key description]);
else
result->SetIntegerWithoutPathExpansion(str_key, [value intValue]);
} else if ([value isKindOfClass:[NSArray class]]) {
- scoped_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
+ std::unique_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
if (sub_arr)
result->SetWithoutPathExpansion(str_key, std::move(sub_arr));
else
result->SetWithoutPathExpansion(str_key,
base::Value::CreateNullValue());
} else if ([value isKindOfClass:[NSDictionary class]]) {
- scoped_ptr<base::DictionaryValue> sub_dict =
+ std::unique_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value);
if (sub_dict)
result->SetWithoutPathExpansion(str_key, std::move(sub_dict));
}
#endif
-scoped_ptr<SkRegion> NativeWindow::DraggableRegionsToSkRegion(
+std::unique_ptr<SkRegion> NativeWindow::DraggableRegionsToSkRegion(
const std::vector<DraggableRegion>& regions) {
- scoped_ptr<SkRegion> sk_region(new SkRegion);
+ std::unique_ptr<SkRegion> sk_region(new SkRegion);
for (const DraggableRegion& region : regions) {
sk_region->op(
region.bounds.x(),
// Convert draggable regions in raw format to SkRegion format. Caller is
// responsible for deleting the returned SkRegion instance.
- scoped_ptr<SkRegion> DraggableRegionsToSkRegion(
+ std::unique_ptr<SkRegion> DraggableRegionsToSkRegion(
const std::vector<DraggableRegion>& regions);
// Converts between content size to window size.
// For custom drag, the whole window is non-draggable and the draggable region
// has to been explicitly provided.
- scoped_ptr<SkRegion> draggable_region_; // used in custom drag.
+ std::unique_ptr<SkRegion> draggable_region_; // used in custom drag.
// Minimum and maximum size, stored as content size.
extensions::SizeConstraints size_constraints_;
if (regions.empty()) {
result.push_back(gfx::Rect(0, 0, width, height));
} else {
- scoped_ptr<SkRegion> draggable(DraggableRegionsToSkRegion(regions));
- scoped_ptr<SkRegion> non_draggable(new SkRegion);
+ std::unique_ptr<SkRegion> draggable(DraggableRegionsToSkRegion(regions));
+ std::unique_ptr<SkRegion> non_draggable(new SkRegion);
non_draggable->op(0, 0, width, height, SkRegion::kUnion_Op);
non_draggable->op(*draggable, SkRegion::kDifference_Op);
for (SkRegion::Iterator it(*non_draggable); !it.done(); it.next()) {
// Returns the restore state for the window.
ui::WindowShowState GetRestoredState();
- scoped_ptr<views::Widget> window_;
+ std::unique_ptr<views::Widget> window_;
views::View* web_view_; // Managed by inspectable_web_contents_.
- scoped_ptr<MenuBar> menu_bar_;
+ std::unique_ptr<MenuBar> menu_bar_;
bool menu_bar_autohide_;
bool menu_bar_visible_;
bool menu_bar_alt_pressed_;
#if defined(USE_X11)
- scoped_ptr<GlobalMenuBarX11> global_menu_bar_;
+ std::unique_ptr<GlobalMenuBarX11> global_menu_bar_;
// Handles window state events.
- scoped_ptr<WindowStateWatcher> window_state_watcher_;
+ std::unique_ptr<WindowStateWatcher> window_state_watcher_;
// The "resizable" flag on Linux is implemented by setting size constraints,
// we need to make sure size constraints are restored when window becomes
#endif
// Handles unhandled keyboard messages coming back from the renderer process.
- scoped_ptr<views::UnhandledKeyboardEventHandler> keyboard_event_handler_;
+ std::unique_ptr<views::UnhandledKeyboardEventHandler> keyboard_event_handler_;
// Map from accelerator to menu item's command id.
accelerator_util::AcceleratorTable accelerator_table_;
base::FilePath file_path_;
Archive::FileInfo file_info_;
- scoped_ptr<net::FileStream> stream_;
+ std::unique_ptr<net::FileStream> stream_;
FileMetaInfo meta_info_;
scoped_refptr<base::TaskRunner> file_task_runner_;
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback,
- scoped_ptr<Request>* out_req,
+ std::unique_ptr<Request>* out_req,
const net::BoundNetLog& net_log) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback,
- scoped_ptr<Request>* out_req,
+ std::unique_ptr<Request>* out_req,
const net::BoundNetLog& net_log) override;
bool SupportsOCSPStapling() override;
private:
base::Lock lock_;
VerifyProc verify_proc_;
- scoped_ptr<net::CertVerifier> default_cert_verifier_;
+ std::unique_ptr<net::CertVerifier> default_cert_verifier_;
DISALLOW_COPY_AND_ASSIGN(AtomCertVerifier);
};
std::pair<scoped_refptr<net::HttpResponseHeaders>*, const std::string&>;
void RunSimpleListener(const AtomNetworkDelegate::SimpleListener& listener,
- scoped_ptr<base::DictionaryValue> details) {
+ std::unique_ptr<base::DictionaryValue> details) {
return listener.Run(*(details.get()));
}
void RunResponseListener(
const AtomNetworkDelegate::ResponseListener& listener,
- scoped_ptr<base::DictionaryValue> details,
+ std::unique_ptr<base::DictionaryValue> details,
const AtomNetworkDelegate::ResponseCallback& callback) {
return listener.Run(*(details.get()), callback);
}
details->SetString("resourceType",
info ? ResourceTypeToString(info->GetResourceType())
: "other");
- scoped_ptr<base::ListValue> list(new base::ListValue);
+ std::unique_ptr<base::ListValue> list(new base::ListValue);
GetUploadData(list.get(), request);
if (!list->empty())
details->Set("uploadData", std::move(list));
void ToDictionary(base::DictionaryValue* details,
const net::HttpRequestHeaders& headers) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
net::HttpRequestHeaders::Iterator it(headers);
while (it.GetNext())
dict->SetString(it.name(), it.value());
if (!headers)
return;
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
size_t iter = 0;
std::string key;
std::string value;
if (dict->GetList(key, &values))
values->AppendString(value);
} else {
- scoped_ptr<base::ListValue> values(new base::ListValue);
+ std::unique_ptr<base::ListValue> values(new base::ListValue);
values->AppendString(value);
dict->Set(key, std::move(values));
}
if (!MatchesFilterCondition(request, info.url_patterns))
return net::OK;
- scoped_ptr<base::DictionaryValue> details(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue);
FillDetailsObject(details.get(), request, args...);
// The |request| could be destroyed before the |callback| is called.
if (!MatchesFilterCondition(request, info.url_patterns))
return;
- scoped_ptr<base::DictionaryValue> details(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue);
FillDetailsObject(details.get(), request, args...);
BrowserThread::PostTask(
template<typename T>
void AtomNetworkDelegate::OnListenerResultInIO(
- uint64_t id, T out, scoped_ptr<base::DictionaryValue> response) {
+ uint64_t id, T out, std::unique_ptr<base::DictionaryValue> response) {
// The request has been destroyed.
if (!ContainsKey(callbacks_, id))
return;
template<typename T>
void AtomNetworkDelegate::OnListenerResultInUI(
uint64_t id, T out, const base::DictionaryValue& response) {
- scoped_ptr<base::DictionaryValue> copy = response.CreateDeepCopy();
+ std::unique_ptr<base::DictionaryValue> copy = response.CreateDeepCopy();
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&AtomNetworkDelegate::OnListenerResultInIO<T>,
// Deal with the results of Listener.
template<typename T>
void OnListenerResultInIO(
- uint64_t id, T out, scoped_ptr<base::DictionaryValue> response);
+ uint64_t id, T out, std::unique_ptr<base::DictionaryValue> response);
template<typename T>
void OnListenerResultInUI(
uint64_t id, T out, const base::DictionaryValue& response);
}
bool AtomURLRequestJobFactory::SetProtocolHandler(
- const std::string& scheme, scoped_ptr<ProtocolHandler> protocol_handler) {
+ const std::string& scheme, std::unique_ptr<ProtocolHandler> protocol_handler) {
if (!protocol_handler) {
ProtocolHandlerMap::iterator it = protocol_handler_map_.find(scheme);
if (it == protocol_handler_map_.end())
return true;
}
-scoped_ptr<ProtocolHandler> AtomURLRequestJobFactory::ReplaceProtocol(
- const std::string& scheme, scoped_ptr<ProtocolHandler> protocol_handler) {
+std::unique_ptr<ProtocolHandler> AtomURLRequestJobFactory::ReplaceProtocol(
+ const std::string& scheme, std::unique_ptr<ProtocolHandler> protocol_handler) {
if (!ContainsKey(protocol_handler_map_, scheme))
return nullptr;
ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme];
// failure (a ProtocolHandler already exists for |scheme|). On success,
// URLRequestJobFactory takes ownership of |protocol_handler|.
bool SetProtocolHandler(
- const std::string& scheme, scoped_ptr<ProtocolHandler> protocol_handler);
+ const std::string& scheme, std::unique_ptr<ProtocolHandler> protocol_handler);
// Intercepts the ProtocolHandler for a scheme. Returns the original protocol
// handler on success, otherwise returns NULL.
- scoped_ptr<ProtocolHandler> ReplaceProtocol(
- const std::string& scheme, scoped_ptr<ProtocolHandler> protocol_handler);
+ std::unique_ptr<ProtocolHandler> ReplaceProtocol(
+ const std::string& scheme, std::unique_ptr<ProtocolHandler> protocol_handler);
// Returns the protocol handler registered with scheme.
ProtocolHandler* GetProtocolHandler(const std::string& scheme) const;
// Pass whatever user passed to the actaul request job.
V8ValueConverter converter;
v8::Local<v8::Context> context = args->isolate()->GetCurrentContext();
- scoped_ptr<base::Value> options(converter.FromV8Value(value, context));
+ std::unique_ptr<base::Value> options(converter.FromV8Value(value, context));
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(callback, true, base::Passed(&options)));
using BeforeStartCallback =
base::Callback<void(v8::Isolate*, v8::Local<v8::Value>)>;
using ResponseCallback =
- base::Callback<void(bool, scoped_ptr<base::Value> options)>;
+ base::Callback<void(bool, std::unique_ptr<base::Value> options)>;
// Ask handler for options in UI thread.
void AskForOptions(v8::Isolate* isolate,
// Subclass should do initailze work here.
virtual void BeforeStartInUI(v8::Isolate*, v8::Local<v8::Value>) {}
- virtual void StartAsync(scoped_ptr<base::Value> options) = 0;
+ virtual void StartAsync(std::unique_ptr<base::Value> options) = 0;
net::URLRequestContextGetter* request_context_getter() const {
return request_context_getter_;
// Called when the JS handler has sent the response, we need to decide whether
// to start, or fail the job.
- void OnResponse(bool success, scoped_ptr<base::Value> value) {
+ void OnResponse(bool success, std::unique_ptr<base::Value> value) {
int error = net::ERR_NOT_IMPLEMENTED;
if (success && value && !internal::IsErrorOptions(value.get(), &error)) {
StartAsync(std::move(value));
: JsAsker<asar::URLRequestAsarJob>(request, network_delegate) {
}
-void URLRequestAsyncAsarJob::StartAsync(scoped_ptr<base::Value> options) {
+void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
base::FilePath::StringType file_path;
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
static_cast<base::DictionaryValue*>(options.get())->GetString(
URLRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*);
// JsAsker:
- void StartAsync(scoped_ptr<base::Value> options) override;
+ void StartAsync(std::unique_ptr<base::Value> options) override;
// URLRequestJob:
void GetResponseInfo(net::HttpResponseInfo* info) override;
status_code_(net::HTTP_NOT_IMPLEMENTED) {
}
-void URLRequestBufferJob::StartAsync(scoped_ptr<base::Value> options) {
+void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
const base::BinaryValue* binary = nullptr;
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
base::DictionaryValue* dict =
URLRequestBufferJob(net::URLRequest*, net::NetworkDelegate*);
// JsAsker:
- void StartAsync(scoped_ptr<base::Value> options) override;
+ void StartAsync(std::unique_ptr<base::Value> options) override;
// URLRequestJob:
void GetResponseInfo(net::HttpResponseInfo* info) override;
}
}
-void URLRequestFetchJob::StartAsync(scoped_ptr<base::Value> options) {
+void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) {
if (!options->IsType(base::Value::TYPE_DICTIONARY)) {
NotifyStartError(net::URLRequestStatus(
net::URLRequestStatus::FAILED, net::ERR_NOT_IMPLEMENTED));
protected:
// JsAsker:
void BeforeStartInUI(v8::Isolate*, v8::Local<v8::Value>) override;
- void StartAsync(scoped_ptr<base::Value> options) override;
+ void StartAsync(std::unique_ptr<base::Value> options) override;
// net::URLRequestJob:
void Kill() override;
private:
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
- scoped_ptr<net::URLFetcher> fetcher_;
+ std::unique_ptr<net::URLFetcher> fetcher_;
scoped_refptr<net::IOBuffer> pending_buffer_;
int pending_buffer_size_;
- scoped_ptr<net::HttpResponseInfo> response_info_;
+ std::unique_ptr<net::HttpResponseInfo> response_info_;
DISALLOW_COPY_AND_ASSIGN(URLRequestFetchJob);
};
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate) {
}
-void URLRequestStringJob::StartAsync(scoped_ptr<base::Value> options) {
+void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get());
URLRequestStringJob(net::URLRequest*, net::NetworkDelegate*);
// JsAsker:
- void StartAsync(scoped_ptr<base::Value> options) override;
+ void StartAsync(std::unique_ptr<base::Value> options) override;
// URLRequestJob:
void GetResponseInfo(net::HttpResponseInfo* info) override;
void NodeDebugger::DidAccept(
net::test_server::StreamListenSocket* server,
- scoped_ptr<net::test_server::StreamListenSocket> socket) {
+ std::unique_ptr<net::test_server::StreamListenSocket> socket) {
// Only accept one session.
if (accepted_socket_) {
socket->Send(std::string("Remote debugging session already active"), true);
// net::test_server::StreamListenSocket::Delegate:
void DidAccept(
net::test_server::StreamListenSocket* server,
- scoped_ptr<net::test_server::StreamListenSocket> socket) override;
+ std::unique_ptr<net::test_server::StreamListenSocket> socket) override;
void DidRead(net::test_server::StreamListenSocket* socket,
const char* data,
int len) override;
uv_async_t weak_up_ui_handle_;
base::Thread thread_;
- scoped_ptr<net::test_server::StreamListenSocket> server_;
- scoped_ptr<net::test_server::StreamListenSocket> accepted_socket_;
+ std::unique_ptr<net::test_server::StreamListenSocket> server_;
+ std::unique_ptr<net::test_server::StreamListenSocket> accepted_socket_;
std::string buffer_;
int content_length_;
NSString* characters =
[[[NSString alloc] initWithCharacters:&character length:1] autorelease];
- scoped_ptr<ui::PlatformAccelerator> platform_accelerator(
+ std::unique_ptr<ui::PlatformAccelerator> platform_accelerator(
new ui::PlatformAcceleratorCocoa(characters, modifiers));
accelerator->set_platform_accelerator(std::move(platform_accelerator));
}
GtkFileFilter* gtk_filter = gtk_file_filter_new();
for (size_t j = 0; j < filter.second.size(); ++j) {
- scoped_ptr<std::string> file_extension(
+ std::unique_ptr<std::string> file_extension(
new std::string("." + filter.second[j]));
gtk_file_filter_add_custom(
gtk_filter,
GetPtr()->SetFolder(folder_item);
}
- scoped_ptr<T> dialog_;
+ std::unique_ptr<T> dialog_;
DISALLOW_COPY_AND_ASSIGN(FileDialog);
};
};
bool CreateDialogThread(RunState* run_state) {
- scoped_ptr<base::Thread> thread(
+ std::unique_ptr<base::Thread> thread(
new base::Thread(ATOM_PRODUCT_NAME "FileDialogThread"));
thread->init_com_with_mta(false);
if (!thread->Start())
const std::string& detail,
const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) {
- scoped_ptr<base::Thread> thread(
+ std::unique_ptr<base::Thread> thread(
new base::Thread(ATOM_PRODUCT_NAME "MessageBoxThread"));
thread->init_com_with_mta(false);
if (!thread->Start()) {
void OnClick() override;
bool HasClickAction() override;
- scoped_ptr<views::StatusIconLinux> icon_;
+ std::unique_ptr<views::StatusIconLinux> icon_;
DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
};
private:
MenuBar* menu_bar_;
int id_;
- scoped_ptr<views::MenuDelegate> adapter_;
- scoped_ptr<views::MenuRunner> menu_runner_;
+ std::unique_ptr<views::MenuDelegate> adapter_;
+ std::unique_ptr<views::MenuRunner> menu_runner_;
DISALLOW_COPY_AND_ASSIGN(MenuDelegate);
};
}
bool ShouldUseGlobalMenuBar() {
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
if (env->HasVar("ELECTRON_FORCE_WINDOW_MENU_BAR"))
return false;
dbus::ObjectProxy* object_proxy =
bus->GetObjectProxy(DBUS_SERVICE_DBUS, dbus::ObjectPath(DBUS_PATH_DBUS));
dbus::MethodCall method_call(DBUS_INTERFACE_DBUS, "ListNames");
- scoped_ptr<dbus::Response> response(object_proxy->CallMethodAndBlock(
+ std::unique_ptr<dbus::Response> response(object_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
bus->ShutdownAndBlock();
SetSizeParams() {}
~SetSizeParams() {}
- scoped_ptr<bool> enable_auto_size;
- scoped_ptr<gfx::Size> min_size;
- scoped_ptr<gfx::Size> max_size;
- scoped_ptr<gfx::Size> normal_size;
+ std::unique_ptr<bool> enable_auto_size;
+ std::unique_ptr<gfx::Size> min_size;
+ std::unique_ptr<gfx::Size> max_size;
+ std::unique_ptr<gfx::Size> normal_size;
};
class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
public:
static v8::Local<v8::Value> Create(v8::Isolate* isolate,
const base::FilePath& path) {
- scoped_ptr<asar::Archive> archive(new asar::Archive(path));
+ std::unique_ptr<asar::Archive> archive(new asar::Archive(path));
if (!archive->Init())
return v8::False(isolate);
return (new Archive(isolate, std::move(archive)))->GetWrapper();
}
protected:
- Archive(v8::Isolate* isolate, scoped_ptr<asar::Archive> archive)
+ Archive(v8::Isolate* isolate, std::unique_ptr<asar::Archive> archive)
: archive_(std::move(archive)) {
Init(isolate);
}
}
private:
- scoped_ptr<asar::Archive> archive_;
+ std::unique_ptr<asar::Archive> archive_;
DISALLOW_COPY_AND_ASSIGN(Archive);
};
const unsigned char* data,
size_t size,
double scale_factor) {
- scoped_ptr<SkBitmap> decoded(new SkBitmap());
+ std::unique_ptr<SkBitmap> decoded(new SkBitmap());
// Try PNG first.
if (!gfx::PNGCodec::Decode(data, size, decoded.get()))
void ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon) {
// Convert the icon from the Windows specific HICON to gfx::ImageSkia.
- scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon));
+ std::unique_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon));
image->AddRepresentation(gfx::ImageSkiaRep(*bitmap, 1.0f));
}
#endif
v8::Local<v8::Object> obj,
ValueVector* args) {
// Perform microtask checkpoint after running JavaScript.
- scoped_ptr<blink::WebScopedRunV8Script> script_scope(
+ std::unique_ptr<blink::WebScopedRunV8Script> script_scope(
Locker::IsBrowserProcess() ?
nullptr : new blink::WebScopedRunV8Script);
// Use node::MakeCallback to call the callback, and it will also run pending
#ifndef ATOM_COMMON_API_LOCKER_H_
#define ATOM_COMMON_API_LOCKER_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/macros.h"
#include "v8/include/v8.h"
namespace mate {
void* operator new(size_t size);
void operator delete(void*, size_t);
- scoped_ptr<v8::Locker> locker_;
+ std::unique_ptr<v8::Locker> locker_;
DISALLOW_COPY_AND_ASSIGN(Locker);
};
std::string error;
base::JSONReader reader;
- scoped_ptr<base::Value> value(reader.ReadToValue(header));
+ std::unique_ptr<base::Value> value(reader.ReadToValue(header));
if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
LOG(ERROR) << "Failed to parse header: " << error;
return false;
return true;
}
- scoped_ptr<ScopedTemporaryFile> temp_file(new ScopedTemporaryFile);
+ std::unique_ptr<ScopedTemporaryFile> temp_file(new ScopedTemporaryFile);
base::FilePath::StringType ext = path.Extension();
if (!temp_file->InitFromFile(&file_, ext, info.offset, info.size))
return false;
base::File file_;
int fd_;
uint32_t header_size_;
- scoped_ptr<base::DictionaryValue> header_;
+ std::unique_ptr<base::DictionaryValue> header_;
// Cached external temporary files.
- base::ScopedPtrHashMap<base::FilePath, scoped_ptr<ScopedTemporaryFile>>
+ base::ScopedPtrHashMap<base::FilePath, std::unique_ptr<ScopedTemporaryFile>>
external_files_;
DISALLOW_COPY_AND_ASSIGN(Archive);
void* context,
const bool succeeded);
- scoped_ptr<google_breakpad::ExceptionHandler> breakpad_;
+ std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
CrashKeyStorage crash_keys_;
uint64_t process_start_time_;
std::vector<UploadReportResult> GetUploadedReports(
const std::string& path) override;
- scoped_ptr<crashpad::SimpleStringDictionary> simple_string_dictionary_;
+ std::unique_ptr<crashpad::SimpleStringDictionary> simple_string_dictionary_;
DISALLOW_COPY_AND_ASSIGN(CrashReporterMac);
};
google_breakpad::CustomClientInfo custom_info_;
bool skip_system_crash_handler_;
- scoped_ptr<google_breakpad::ExceptionHandler> breakpad_;
+ std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
DISALLOW_COPY_AND_ASSIGN(CrashReporterWin);
};
#include "base/memory/weak_ptr.h"
#include "native_mate/function_template.h"
#include "native_mate/scoped_persistent.h"
-#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
namespace mate {
v8::EscapableHandleScope handle_scope(isolate);
if (!function.IsAlive())
return v8::Null(isolate);
- scoped_ptr<blink::WebScopedRunV8Script> script_scope(
+ std::unique_ptr<v8::MicrotasksScope> script_scope(
Locker::IsBrowserProcess() ?
- nullptr : new blink::WebScopedRunV8Script);
+ nullptr :
+ new v8::MicrotasksScope(isolate,
+ v8::MicrotasksScope::kRunMicrotasks));
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
v8::HandleScope handle_scope(isolate);
if (!function.IsAlive())
return;
- scoped_ptr<blink::WebScopedRunV8Script> script_scope(
+ std::unique_ptr<v8::MicrotasksScope> script_scope(
Locker::IsBrowserProcess() ?
- nullptr : new blink::WebScopedRunV8Script);
+ nullptr :
+ new v8::MicrotasksScope(isolate,
+ v8::MicrotasksScope::kRunMicrotasks));
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
ReturnType ret = ReturnType();
if (!function.IsAlive())
return ret;
- scoped_ptr<blink::WebScopedRunV8Script> script_scope(
+ std::unique_ptr<v8::MicrotasksScope> script_scope(
Locker::IsBrowserProcess() ?
- nullptr : new blink::WebScopedRunV8Script);
+ nullptr :
+ new v8::MicrotasksScope(isolate,
+ v8::MicrotasksScope::kRunMicrotasks));
v8::Local<v8::Function> holder = function.NewHandle(isolate);
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
}
// static
-bool Converter<content::PermissionStatus>::FromV8(
+bool Converter<blink::mojom::PermissionStatus>::FromV8(
v8::Isolate* isolate,
v8::Local<v8::Value> val,
- content::PermissionStatus* out) {
+ blink::mojom::PermissionStatus* out) {
bool result;
if (!ConvertFromV8(isolate, val, &result))
return false;
if (result)
- *out = content::PermissionStatus::GRANTED;
+ *out = blink::mojom::PermissionStatus::GRANTED;
else
- *out = content::PermissionStatus::DENIED;
+ *out = blink::mojom::PermissionStatus::DENIED;
return true;
}
#include "content/public/browser/permission_type.h"
#include "content/public/common/menu_item.h"
-#include "content/public/common/permission_status.mojom.h"
#include "content/public/common/stop_find_action.h"
+#include "third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h"
#include "native_mate/converter.h"
namespace content {
};
template<>
-struct Converter<content::PermissionStatus> {
+struct Converter<blink::mojom::PermissionStatus> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
- content::PermissionStatus* out);
+ blink::mojom::PermissionStatus* out);
};
template<>
// static
v8::Local<v8::Value> Converter<const net::URLRequest*>::ToV8(
v8::Isolate* isolate, const net::URLRequest* val) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetString("method", val->method());
std::string url;
if (!val->url_chain().empty()) url = val->url().spec();
dict->SetStringWithoutPathExpansion("url", url);
dict->SetString("referrer", val->referrer());
- scoped_ptr<base::ListValue> list(new base::ListValue);
+ std::unique_ptr<base::ListValue> list(new base::ListValue);
atom::GetUploadData(list.get(), val);
if (!list->empty())
dict->Set("uploadData", std::move(list));
const net::UploadDataStream* upload_data = request->get_upload();
if (!upload_data)
return;
- const std::vector<scoped_ptr<net::UploadElementReader>>* readers =
+ const std::vector<std::unique_ptr<net::UploadElementReader>>* readers =
upload_data->GetElementReaders();
for (const auto& reader : *readers) {
- scoped_ptr<base::DictionaryValue> upload_data_dict(
+ std::unique_ptr<base::DictionaryValue> upload_data_dict(
new base::DictionaryValue);
if (reader->AsBytesReader()) {
const net::UploadBytesElementReader* bytes_reader =
reader->AsBytesReader();
- scoped_ptr<base::Value> bytes(
+ std::unique_ptr<base::Value> bytes(
base::BinaryValue::CreateWithCopiedBuffer(bytes_reader->bytes(),
bytes_reader->length()));
upload_data_dict->Set("bytes", std::move(bytes));
if (!state->UpdateAndCheckUniqueness(val))
return base::Value::CreateNullValue().release();
- scoped_ptr<v8::Context::Scope> scope;
+ std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to
// that context, but change back after val is converted.
if (!val->CreationContext().IsEmpty() &&
if (!state->UpdateAndCheckUniqueness(val))
return base::Value::CreateNullValue().release();
- scoped_ptr<v8::Context::Scope> scope;
+ std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to
// that context, but change back after val is converted.
if (!val->CreationContext().IsEmpty() &&
val->CreationContext() != isolate->GetCurrentContext())
scope.reset(new v8::Context::Scope(val->CreationContext()));
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
v8::Local<v8::Array> property_names(val->GetOwnPropertyNames());
for (uint32_t i = 0; i < property_names->Length(); ++i) {
child_v8 = v8::Null(isolate);
}
- scoped_ptr<base::Value> child(FromV8ValueImpl(state, child_v8, isolate));
+ std::unique_ptr<base::Value> child(FromV8ValueImpl(state, child_v8, isolate));
if (!child.get())
// JSON.stringify skips properties whose values don't serialize, for
// example undefined and functions. Emulate that behavior.
bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::DictionaryValue* out) {
- scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
- scoped_ptr<base::Value> value(converter->FromV8Value(
+ std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
+ std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext()));
if (value && value->IsType(base::Value::TYPE_DICTIONARY)) {
out->Swap(static_cast<base::DictionaryValue*>(value.get()));
v8::Local<v8::Value> Converter<base::DictionaryValue>::ToV8(
v8::Isolate* isolate,
const base::DictionaryValue& val) {
- scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
+ std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
return converter->ToV8Value(&val, isolate->GetCurrentContext());
}
bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::ListValue* out) {
- scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
- scoped_ptr<base::Value> value(converter->FromV8Value(
+ std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
+ std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext()));
if (value->IsType(base::Value::TYPE_LIST)) {
out->Swap(static_cast<base::ListValue*>(value.get()));
v8::Local<v8::Value> Converter<base::ListValue>::ToV8(
v8::Isolate* isolate,
const base::ListValue& val) {
- scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
+ std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
return converter->ToV8Value(&val, isolate->GetCurrentContext());
}
// Convert the given vector to an array of C-strings. The strings in the
// returned vector are only guaranteed valid so long as the vector of strings
// is not modified.
-scoped_ptr<const char*[]> StringVectorToArgArray(
+std::unique_ptr<const char*[]> StringVectorToArgArray(
const std::vector<std::string>& vector) {
- scoped_ptr<const char*[]> array(new const char*[vector.size()]);
+ std::unique_ptr<const char*[]> array(new const char*[vector.size()]);
for (size_t i = 0; i < vector.size(); ++i) {
array[i] = vector[i].c_str();
}
#if defined(OS_WIN)
// uv_init overrides error mode to suppress the default crash dialog, bring
// it back if user wants to show it.
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
if (env->HasVar("ELECTRON_DEFAULT_ERROR_MODE"))
SetErrorMode(0);
#endif
std::string script_path_str = script_path.AsUTF8Unsafe();
args.insert(args.begin() + 1, script_path_str.c_str());
- scoped_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
+ std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
node::Environment* env = node::CreateEnvironment(
context->GetIsolate(), uv_default_loop(), context,
args.size(), c_argv.get(), 0, nullptr);
v8::Context::Scope context_scope(env->context());
// Perform microtask checkpoint after running JavaScript.
- scoped_ptr<blink::WebScopedRunV8Script> script_scope(
+ std::unique_ptr<blink::WebScopedRunV8Script> script_scope(
is_browser_ ? nullptr : new blink::WebScopedRunV8Script);
// Deal with uv events.
args->GetNext(&has_user_gesture);
ScriptExecutionCallback::CompletionCallback completion_callback;
args->GetNext(&completion_callback);
- scoped_ptr<blink::WebScriptExecutionCallback> callback(
+ std::unique_ptr<blink::WebScriptExecutionCallback> callback(
new ScriptExecutionCallback(completion_callback));
web_frame_->requestExecuteScriptAndReturnValue(
blink::WebScriptSource(code),
blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate);
void ClearCache(v8::Isolate* isolate);
- scoped_ptr<SpellCheckClient> spell_check_client_;
+ std::unique_ptr<SpellCheckClient> spell_check_client_;
blink::WebLocalFrame* web_frame_;
AtomRendererClient::~AtomRendererClient() {
}
-void AtomRendererClient::WebKitInitialized() {
+void AtomRendererClient::RenderThreadStarted() {
blink::WebCustomElement::addEmbedderCustomElementName("webview");
blink::WebCustomElement::addEmbedderCustomElementName("browserplugin");
OverrideNodeArrayBuffer();
-}
-
-void AtomRendererClient::RenderThreadStarted() {
- content::RenderThread::Get()->AddObserver(this);
#if defined(OS_WIN)
// Set ApplicationUserModelID in renderer process.
#include <vector>
#include "content/public/renderer/content_renderer_client.h"
-#include "content/public/renderer/render_process_observer.h"
namespace atom {
class AtomBindings;
class NodeBindings;
-class AtomRendererClient : public content::ContentRendererClient,
- public content::RenderProcessObserver {
+class AtomRendererClient : public content::ContentRendererClient {
public:
AtomRendererClient();
virtual ~AtomRendererClient();
DISABLE,
};
- // content::RenderProcessObserver:
- void WebKitInitialized() override;
-
// content::ContentRendererClient:
void RenderThreadStarted() override;
void RenderFrameCreated(content::RenderFrame*) override;
std::string* error_html,
base::string16* error_description) override;
- scoped_ptr<NodeBindings> node_bindings_;
- scoped_ptr<AtomBindings> atom_bindings_;
+ std::unique_ptr<NodeBindings> node_bindings_;
+ std::unique_ptr<AtomBindings> atom_bindings_;
DISALLOW_COPY_AND_ASSIGN(AtomRendererClient);
};
-Subproject commit 477290bfa105053719a2de5f42089eb8ba261713
+Subproject commit 3f18ef50c26a6cea42845292abe076fb627f5ef1