Merge pull request #12647 from nornagon/chromium-style
Fix a bunch of chromium-style errors
This commit is contained in:
commit
55e2dbdbc8
176 changed files with 817 additions and 557 deletions
|
@ -135,7 +135,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
|
void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
|
||||||
const char* separator,
|
const char* separator,
|
||||||
const char* cmd_switch) {
|
const char* cmd_switch) {
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
auto string_with_separator = command_line->GetSwitchValueASCII(cmd_switch);
|
auto string_with_separator = command_line->GetSwitchValueASCII(cmd_switch);
|
||||||
if (!string_with_separator.empty())
|
if (!string_with_separator.empty())
|
||||||
*vec = base::SplitString(string_with_separator, separator,
|
*vec = base::SplitString(string_with_separator, separator,
|
||||||
|
@ -146,7 +146,7 @@ void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
|
||||||
|
|
||||||
void AddPepperFlashFromCommandLine(
|
void AddPepperFlashFromCommandLine(
|
||||||
std::vector<content::PepperPluginInfo>* plugins) {
|
std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
base::FilePath flash_path =
|
base::FilePath flash_path =
|
||||||
command_line->GetSwitchValuePath(switches::kPpapiFlashPath);
|
command_line->GetSwitchValuePath(switches::kPpapiFlashPath);
|
||||||
if (flash_path.empty())
|
if (flash_path.empty())
|
||||||
|
@ -161,7 +161,7 @@ void AddPepperFlashFromCommandLine(
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||||
void AddWidevineCdmFromCommandLine(
|
void AddWidevineCdmFromCommandLine(
|
||||||
std::vector<content::PepperPluginInfo>* plugins) {
|
std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
base::FilePath widevine_cdm_path =
|
base::FilePath widevine_cdm_path =
|
||||||
command_line->GetSwitchValuePath(switches::kWidevineCdmPath);
|
command_line->GetSwitchValuePath(switches::kWidevineCdmPath);
|
||||||
if (widevine_cdm_path.empty())
|
if (widevine_cdm_path.empty())
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace atom {
|
||||||
class AtomContentClient : public brightray::ContentClient {
|
class AtomContentClient : public brightray::ContentClient {
|
||||||
public:
|
public:
|
||||||
AtomContentClient();
|
AtomContentClient();
|
||||||
virtual ~AtomContentClient();
|
~AtomContentClient() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// content::ContentClient:
|
// content::ContentClient:
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#ifdef ENABLE_RUN_AS_NODE
|
#ifdef ENABLE_RUN_AS_NODE
|
||||||
const auto kRunAsNode = "ELECTRON_RUN_AS_NODE";
|
const char kRunAsNode[] = "ELECTRON_RUN_AS_NODE";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_RUN_AS_NODE) || defined(OS_WIN)
|
#if defined(ENABLE_RUN_AS_NODE) || defined(OS_WIN)
|
||||||
|
|
|
@ -61,7 +61,7 @@ AtomMainDelegate::AtomMainDelegate() {}
|
||||||
AtomMainDelegate::~AtomMainDelegate() {}
|
AtomMainDelegate::~AtomMainDelegate() {}
|
||||||
|
|
||||||
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
logging::LoggingSettings settings;
|
logging::LoggingSettings settings;
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
@ -129,7 +129,7 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||||
void AtomMainDelegate::PreSandboxStartup() {
|
void AtomMainDelegate::PreSandboxStartup() {
|
||||||
brightray::MainDelegate::PreSandboxStartup();
|
brightray::MainDelegate::PreSandboxStartup();
|
||||||
|
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
std::string process_type =
|
std::string process_type =
|
||||||
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace atom {
|
||||||
class AtomMainDelegate : public brightray::MainDelegate {
|
class AtomMainDelegate : public brightray::MainDelegate {
|
||||||
public:
|
public:
|
||||||
AtomMainDelegate();
|
AtomMainDelegate();
|
||||||
~AtomMainDelegate();
|
~AtomMainDelegate() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// content::ContentMainDelegate:
|
// content::ContentMainDelegate:
|
||||||
|
|
|
@ -17,7 +17,7 @@ bool IsUrlArg(const base::CommandLine::CharType* arg) {
|
||||||
// the first character must be a letter for this to be a URL
|
// the first character must be a letter for this to be a URL
|
||||||
auto c = *arg;
|
auto c = *arg;
|
||||||
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
|
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
|
||||||
for (auto p = arg + 1; *p; ++p) {
|
for (auto* p = arg + 1; *p; ++p) {
|
||||||
c = *p;
|
c = *p;
|
||||||
|
|
||||||
// colon indicates that the argument starts with a URI scheme
|
// colon indicates that the argument starts with a URI scheme
|
||||||
|
@ -1377,7 +1377,7 @@ bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {
|
||||||
static const char* prefixes[] = {"--", "-", "/"};
|
static const char* prefixes[] = {"--", "-", "/"};
|
||||||
|
|
||||||
int prefix_length = 0;
|
int prefix_length = 0;
|
||||||
for (auto& prefix : prefixes) {
|
for (auto*& prefix : prefixes) {
|
||||||
if (base::StartsWith(a, prefix, base::CompareCase::SENSITIVE)) {
|
if (base::StartsWith(a, prefix, base::CompareCase::SENSITIVE)) {
|
||||||
prefix_length = strlen(prefix);
|
prefix_length = strlen(prefix);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace atom {
|
||||||
class UvTaskRunner : public base::SingleThreadTaskRunner {
|
class UvTaskRunner : public base::SingleThreadTaskRunner {
|
||||||
public:
|
public:
|
||||||
explicit UvTaskRunner(uv_loop_t* loop);
|
explicit UvTaskRunner(uv_loop_t* loop);
|
||||||
~UvTaskRunner() override;
|
|
||||||
|
|
||||||
// base::SingleThreadTaskRunner:
|
// base::SingleThreadTaskRunner:
|
||||||
bool PostDelayedTask(const base::Location& from_here,
|
bool PostDelayedTask(const base::Location& from_here,
|
||||||
|
@ -30,6 +29,7 @@ class UvTaskRunner : public base::SingleThreadTaskRunner {
|
||||||
base::TimeDelta delay) override;
|
base::TimeDelta delay) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
~UvTaskRunner() override;
|
||||||
static void OnTimeout(uv_timer_t* timer);
|
static void OnTimeout(uv_timer_t* timer);
|
||||||
static void OnClose(uv_handle_t* handle);
|
static void OnClose(uv_handle_t* handle);
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,16 @@ struct Converter<content::CertificateRequestResultType> {
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
ProcessMetric::ProcessMetric(int type,
|
||||||
|
base::ProcessId pid,
|
||||||
|
std::unique_ptr<base::ProcessMetrics> metrics) {
|
||||||
|
this->type = type;
|
||||||
|
this->pid = pid;
|
||||||
|
this->metrics = std::move(metrics);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessMetric::~ProcessMetric() = default;
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -927,12 +937,12 @@ void App::DisableDomainBlockingFor3DAPIs(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool App::IsAccessibilitySupportEnabled() {
|
bool App::IsAccessibilitySupportEnabled() {
|
||||||
auto ax_state = content::BrowserAccessibilityState::GetInstance();
|
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
|
||||||
return ax_state->IsAccessibleBrowser();
|
return ax_state->IsAccessibleBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::SetAccessibilitySupportEnabled(bool enabled) {
|
void App::SetAccessibilitySupportEnabled(bool enabled) {
|
||||||
auto ax_state = content::BrowserAccessibilityState::GetInstance();
|
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
ax_state->OnScreenReaderDetected();
|
ax_state->OnScreenReaderDetected();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1054,7 +1064,7 @@ void App::GetFileIcon(const base::FilePath& path, mate::Arguments* args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto icon_manager = g_browser_process->GetIconManager();
|
auto* icon_manager = g_browser_process->GetIconManager();
|
||||||
gfx::Image* icon =
|
gfx::Image* icon =
|
||||||
icon_manager->LookupIconFromFilepath(normalized_path, icon_size);
|
icon_manager->LookupIconFromFilepath(normalized_path, icon_size);
|
||||||
if (icon) {
|
if (icon) {
|
||||||
|
@ -1132,7 +1142,7 @@ void App::EnableMixedSandbox(mate::Arguments* args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
if (command_line->HasSwitch(::switches::kNoSandbox)) {
|
if (command_line->HasSwitch(::switches::kNoSandbox)) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
const base::CommandLine::CharType* noSandboxArg = L"--no-sandbox";
|
const base::CommandLine::CharType* noSandboxArg = L"--no-sandbox";
|
||||||
|
@ -1263,7 +1273,7 @@ void App::BuildPrototype(v8::Isolate* isolate,
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
|
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
if (base::EndsWith(switch_string, "-path",
|
if (base::EndsWith(switch_string, "-path",
|
||||||
base::CompareCase::INSENSITIVE_ASCII) ||
|
base::CompareCase::INSENSITIVE_ASCII) ||
|
||||||
|
@ -1301,7 +1311,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||||
v8::Local<v8::Context> context,
|
v8::Local<v8::Context> context,
|
||||||
void* priv) {
|
void* priv) {
|
||||||
v8::Isolate* isolate = context->GetIsolate();
|
v8::Isolate* isolate = context->GetIsolate();
|
||||||
auto command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
mate::Dictionary dict(isolate, exports);
|
mate::Dictionary dict(isolate, exports);
|
||||||
dict.Set("App", atom::api::App::GetConstructor(isolate)->GetFunction());
|
dict.Set("App", atom::api::App::GetConstructor(isolate)->GetFunction());
|
||||||
|
|
|
@ -52,11 +52,8 @@ struct ProcessMetric {
|
||||||
|
|
||||||
ProcessMetric(int type,
|
ProcessMetric(int type,
|
||||||
base::ProcessId pid,
|
base::ProcessId pid,
|
||||||
std::unique_ptr<base::ProcessMetrics> metrics) {
|
std::unique_ptr<base::ProcessMetrics> metrics);
|
||||||
this->type = type;
|
~ProcessMetric();
|
||||||
this->pid = pid;
|
|
||||||
this->metrics = std::move(metrics);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class AutoUpdater : public mate::EventEmitter<AutoUpdater>,
|
||||||
void OnError(const std::string& error) override;
|
void OnError(const std::string& error) override;
|
||||||
void OnError(const std::string& message,
|
void OnError(const std::string& message,
|
||||||
const int code,
|
const int code,
|
||||||
const std::string& domain);
|
const std::string& domain) override;
|
||||||
void OnCheckingForUpdate() override;
|
void OnCheckingForUpdate() override;
|
||||||
void OnUpdateAvailable() override;
|
void OnUpdateAvailable() override;
|
||||||
void OnUpdateNotAvailable() override;
|
void OnUpdateNotAvailable() override;
|
||||||
|
|
|
@ -135,7 +135,7 @@ void BrowserWindow::DidFirstVisuallyNonEmptyPaint() {
|
||||||
|
|
||||||
// When there is a non-empty first paint, resize the RenderWidget to force
|
// When there is a non-empty first paint, resize the RenderWidget to force
|
||||||
// Chromium to draw.
|
// Chromium to draw.
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
view->Show();
|
view->Show();
|
||||||
view->SetSize(window()->GetContentSize());
|
view->SetSize(window()->GetContentSize());
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ void BrowserWindow::BuildPrototype(v8::Isolate* isolate,
|
||||||
// static
|
// static
|
||||||
v8::Local<v8::Value> BrowserWindow::From(v8::Isolate* isolate,
|
v8::Local<v8::Value> BrowserWindow::From(v8::Isolate* isolate,
|
||||||
NativeWindow* native_window) {
|
NativeWindow* native_window) {
|
||||||
auto existing = TrackableObject::FromWrappedClass(isolate, native_window);
|
auto* existing = TrackableObject::FromWrappedClass(isolate, native_window);
|
||||||
if (existing)
|
if (existing)
|
||||||
return existing->GetWrapper();
|
return existing->GetWrapper();
|
||||||
else
|
else
|
||||||
|
|
|
@ -250,7 +250,7 @@ Cookies::~Cookies() {}
|
||||||
void Cookies::Get(const base::DictionaryValue& filter,
|
void Cookies::Get(const base::DictionaryValue& filter,
|
||||||
const GetCallback& callback) {
|
const GetCallback& callback) {
|
||||||
std::unique_ptr<base::DictionaryValue> copied(filter.CreateDeepCopy());
|
std::unique_ptr<base::DictionaryValue> copied(filter.CreateDeepCopy());
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter), Passed(&copied),
|
base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter), Passed(&copied),
|
||||||
|
@ -260,7 +260,7 @@ void Cookies::Get(const base::DictionaryValue& filter,
|
||||||
void Cookies::Remove(const GURL& url,
|
void Cookies::Remove(const GURL& url,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(RemoveCookieOnIOThread, base::RetainedRef(getter), url,
|
base::BindOnce(RemoveCookieOnIOThread, base::RetainedRef(getter), url,
|
||||||
|
@ -270,7 +270,7 @@ void Cookies::Remove(const GURL& url,
|
||||||
void Cookies::Set(const base::DictionaryValue& details,
|
void Cookies::Set(const base::DictionaryValue& details,
|
||||||
const SetCallback& callback) {
|
const SetCallback& callback) {
|
||||||
std::unique_ptr<base::DictionaryValue> copied(details.CreateDeepCopy());
|
std::unique_ptr<base::DictionaryValue> copied(details.CreateDeepCopy());
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(SetCookieOnIO, base::RetainedRef(getter), Passed(&copied),
|
base::BindOnce(SetCookieOnIO, base::RetainedRef(getter), Passed(&copied),
|
||||||
|
@ -278,7 +278,7 @@ void Cookies::Set(const base::DictionaryValue& details,
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cookies::FlushStore(const base::Closure& callback) {
|
void Cookies::FlushStore(const base::Closure& callback) {
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(FlushCookieStoreOnIOThread, base::RetainedRef(getter),
|
base::BindOnce(FlushCookieStoreOnIOThread, base::RetainedRef(getter),
|
||||||
|
|
|
@ -207,7 +207,7 @@ void DownloadItem::BuildPrototype(v8::Isolate* isolate,
|
||||||
// static
|
// static
|
||||||
mate::Handle<DownloadItem> DownloadItem::Create(v8::Isolate* isolate,
|
mate::Handle<DownloadItem> DownloadItem::Create(v8::Isolate* isolate,
|
||||||
content::DownloadItem* item) {
|
content::DownloadItem* item) {
|
||||||
auto existing = TrackableObject::FromWrappedClass(isolate, item);
|
auto* existing = TrackableObject::FromWrappedClass(isolate, item);
|
||||||
if (existing)
|
if (existing)
|
||||||
return mate::CreateHandle(isolate, static_cast<DownloadItem*>(existing));
|
return mate::CreateHandle(isolate, static_cast<DownloadItem*>(existing));
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class DownloadItem : public mate::TrackableObject<DownloadItem>,
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DownloadItem(v8::Isolate* isolate, content::DownloadItem* download_item);
|
DownloadItem(v8::Isolate* isolate, content::DownloadItem* download_item);
|
||||||
~DownloadItem();
|
~DownloadItem() override;
|
||||||
|
|
||||||
// Override content::DownloadItem::Observer methods
|
// Override content::DownloadItem::Observer methods
|
||||||
void OnDownloadUpdated(content::DownloadItem* download) override;
|
void OnDownloadUpdated(content::DownloadItem* download) override;
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace api {
|
||||||
class MenuMac : public Menu {
|
class MenuMac : public Menu {
|
||||||
protected:
|
protected:
|
||||||
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
||||||
|
~MenuMac() override;
|
||||||
|
|
||||||
void PopupAt(TopLevelWindow* window,
|
void PopupAt(TopLevelWindow* window,
|
||||||
int x,
|
int x,
|
||||||
|
|
|
@ -21,21 +21,22 @@ namespace atom {
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
||||||
MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
MenuMac::MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
||||||
: Menu(isolate, wrapper),
|
: Menu(isolate, wrapper), weak_factory_(this) {}
|
||||||
weak_factory_(this) {
|
|
||||||
}
|
MenuMac::~MenuMac() = default;
|
||||||
|
|
||||||
void MenuMac::PopupAt(TopLevelWindow* window,
|
void MenuMac::PopupAt(TopLevelWindow* window,
|
||||||
int x, int y, int positioning_item,
|
int x,
|
||||||
|
int y,
|
||||||
|
int positioning_item,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
NativeWindow* native_window = window->window();
|
NativeWindow* native_window = window->window();
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(),
|
auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(),
|
||||||
native_window->GetWeakPtr(),
|
native_window->GetWeakPtr(), window->weak_map_id(), x,
|
||||||
window->weak_map_id(), x, y,
|
y, positioning_item, callback);
|
||||||
positioning_item, callback);
|
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup);
|
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +52,9 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
||||||
|
|
||||||
auto close_callback = base::Bind(
|
auto close_callback = base::Bind(
|
||||||
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);
|
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);
|
||||||
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>(
|
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>([
|
||||||
[[AtomMenuController alloc] initWithModel:model()
|
[AtomMenuController alloc] initWithModel:model()
|
||||||
useDefaultAccelerator:NO]);
|
useDefaultAccelerator:NO]);
|
||||||
NSMenu* menu = [popup_controllers_[window_id] menu];
|
NSMenu* menu = [popup_controllers_[window_id] menu];
|
||||||
NSView* view = [nswindow contentView];
|
NSView* view = [nswindow contentView];
|
||||||
|
|
||||||
|
@ -128,9 +129,9 @@ void MenuMac::OnClosed(int32_t window_id, base::Closure callback) {
|
||||||
// static
|
// static
|
||||||
void Menu::SetApplicationMenu(Menu* base_menu) {
|
void Menu::SetApplicationMenu(Menu* base_menu) {
|
||||||
MenuMac* menu = static_cast<MenuMac*>(base_menu);
|
MenuMac* menu = static_cast<MenuMac*>(base_menu);
|
||||||
base::scoped_nsobject<AtomMenuController> menu_controller(
|
base::scoped_nsobject<AtomMenuController> menu_controller([
|
||||||
[[AtomMenuController alloc] initWithModel:menu->model_.get()
|
[AtomMenuController alloc] initWithModel:menu->model_.get()
|
||||||
useDefaultAccelerator:YES]);
|
useDefaultAccelerator:YES]);
|
||||||
[NSApp setMainMenu:[menu_controller menu]];
|
[NSApp setMainMenu:[menu_controller menu]];
|
||||||
|
|
||||||
// Ensure the menu_controller_ is destroyed after main menu is set.
|
// Ensure the menu_controller_ is destroyed after main menu is set.
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace api {
|
||||||
MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
MenuViews::MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper)
|
||||||
: Menu(isolate, wrapper), weak_factory_(this) {}
|
: Menu(isolate, wrapper), weak_factory_(this) {}
|
||||||
|
|
||||||
|
MenuViews::~MenuViews() = default;
|
||||||
|
|
||||||
void MenuViews::PopupAt(TopLevelWindow* window,
|
void MenuViews::PopupAt(TopLevelWindow* window,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace api {
|
||||||
class MenuViews : public Menu {
|
class MenuViews : public Menu {
|
||||||
public:
|
public:
|
||||||
MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
||||||
|
~MenuViews() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void PopupAt(TopLevelWindow* window,
|
void PopupAt(TopLevelWindow* window,
|
||||||
|
|
|
@ -83,7 +83,7 @@ void Protocol::UnregisterProtocol(const std::string& scheme,
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
CompletionCallback callback;
|
CompletionCallback callback;
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
content::BrowserThread::PostTaskAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(&Protocol::UnregisterProtocolInIO,
|
base::BindOnce(&Protocol::UnregisterProtocolInIO,
|
||||||
|
@ -95,7 +95,7 @@ void Protocol::UnregisterProtocol(const std::string& scheme,
|
||||||
Protocol::ProtocolError Protocol::UnregisterProtocolInIO(
|
Protocol::ProtocolError Protocol::UnregisterProtocolInIO(
|
||||||
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter,
|
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter,
|
||||||
const std::string& scheme) {
|
const std::string& scheme) {
|
||||||
auto job_factory = static_cast<AtomURLRequestJobFactory*>(
|
auto* job_factory = static_cast<AtomURLRequestJobFactory*>(
|
||||||
request_context_getter->job_factory());
|
request_context_getter->job_factory());
|
||||||
if (!job_factory->HasProtocolHandler(scheme))
|
if (!job_factory->HasProtocolHandler(scheme))
|
||||||
return PROTOCOL_NOT_REGISTERED;
|
return PROTOCOL_NOT_REGISTERED;
|
||||||
|
@ -105,7 +105,7 @@ Protocol::ProtocolError Protocol::UnregisterProtocolInIO(
|
||||||
|
|
||||||
void Protocol::IsProtocolHandled(const std::string& scheme,
|
void Protocol::IsProtocolHandled(const std::string& scheme,
|
||||||
const BooleanCallback& callback) {
|
const BooleanCallback& callback) {
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
content::BrowserThread::PostTaskAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::Bind(&Protocol::IsProtocolHandledInIO, base::RetainedRef(getter),
|
base::Bind(&Protocol::IsProtocolHandledInIO, base::RetainedRef(getter),
|
||||||
|
@ -124,7 +124,7 @@ void Protocol::UninterceptProtocol(const std::string& scheme,
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
CompletionCallback callback;
|
CompletionCallback callback;
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
content::BrowserThread::PostTaskAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(&Protocol::UninterceptProtocolInIO,
|
base::BindOnce(&Protocol::UninterceptProtocolInIO,
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context);
|
Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context);
|
||||||
~Protocol();
|
~Protocol() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Possible errors.
|
// Possible errors.
|
||||||
|
@ -100,7 +100,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
CompletionCallback callback;
|
CompletionCallback callback;
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
content::BrowserThread::PostTaskAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(&Protocol::RegisterProtocolInIO<RequestJob>,
|
base::BindOnce(&Protocol::RegisterProtocolInIO<RequestJob>,
|
||||||
|
@ -113,7 +113,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
const std::string& scheme,
|
const std::string& scheme,
|
||||||
const Handler& handler) {
|
const Handler& handler) {
|
||||||
auto job_factory = static_cast<AtomURLRequestJobFactory*>(
|
auto* job_factory = static_cast<AtomURLRequestJobFactory*>(
|
||||||
request_context_getter->job_factory());
|
request_context_getter->job_factory());
|
||||||
if (job_factory->IsHandledProtocol(scheme))
|
if (job_factory->IsHandledProtocol(scheme))
|
||||||
return PROTOCOL_REGISTERED;
|
return PROTOCOL_REGISTERED;
|
||||||
|
@ -146,7 +146,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
CompletionCallback callback;
|
CompletionCallback callback;
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
content::BrowserThread::PostTaskAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(&Protocol::InterceptProtocolInIO<RequestJob>,
|
base::BindOnce(&Protocol::InterceptProtocolInIO<RequestJob>,
|
||||||
|
@ -159,7 +159,7 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
const std::string& scheme,
|
const std::string& scheme,
|
||||||
const Handler& handler) {
|
const Handler& handler) {
|
||||||
auto job_factory = static_cast<AtomURLRequestJobFactory*>(
|
auto* job_factory = static_cast<AtomURLRequestJobFactory*>(
|
||||||
request_context_getter->job_factory());
|
request_context_getter->job_factory());
|
||||||
if (!job_factory->IsHandledProtocol(scheme))
|
if (!job_factory->IsHandledProtocol(scheme))
|
||||||
return PROTOCOL_NOT_REGISTERED;
|
return PROTOCOL_NOT_REGISTERED;
|
||||||
|
|
|
@ -326,14 +326,14 @@ void DoCacheActionInIO(
|
||||||
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
||||||
Session::CacheAction action,
|
Session::CacheAction action,
|
||||||
const net::CompletionCallback& callback) {
|
const net::CompletionCallback& callback) {
|
||||||
auto request_context = context_getter->GetURLRequestContext();
|
auto* request_context = context_getter->GetURLRequestContext();
|
||||||
auto http_cache = request_context->http_transaction_factory()->GetCache();
|
auto* http_cache = request_context->http_transaction_factory()->GetCache();
|
||||||
if (!http_cache)
|
if (!http_cache)
|
||||||
RunCallbackInUI<int>(callback, net::ERR_FAILED);
|
RunCallbackInUI<int>(callback, net::ERR_FAILED);
|
||||||
|
|
||||||
// Call GetBackend and make the backend's ptr accessable in OnGetBackend.
|
// Call GetBackend and make the backend's ptr accessable in OnGetBackend.
|
||||||
using BackendPtr = disk_cache::Backend*;
|
using BackendPtr = disk_cache::Backend*;
|
||||||
auto* backend_ptr = new BackendPtr(nullptr);
|
auto** backend_ptr = new BackendPtr(nullptr);
|
||||||
net::CompletionCallback on_get_backend =
|
net::CompletionCallback on_get_backend =
|
||||||
base::Bind(&OnGetBackend, base::Owned(backend_ptr), action, callback);
|
base::Bind(&OnGetBackend, base::Owned(backend_ptr), action, callback);
|
||||||
int rv = http_cache->GetBackend(backend_ptr, on_get_backend);
|
int rv = http_cache->GetBackend(backend_ptr, on_get_backend);
|
||||||
|
@ -344,7 +344,7 @@ void DoCacheActionInIO(
|
||||||
void SetProxyInIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
void SetProxyInIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
||||||
const net::ProxyConfig& config,
|
const net::ProxyConfig& config,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
auto proxy_service = getter->GetURLRequestContext()->proxy_service();
|
auto* proxy_service = getter->GetURLRequestContext()->proxy_service();
|
||||||
proxy_service->ResetConfigService(
|
proxy_service->ResetConfigService(
|
||||||
base::WrapUnique(new net::ProxyConfigServiceFixed(config)));
|
base::WrapUnique(new net::ProxyConfigServiceFixed(config)));
|
||||||
// Refetches and applies the new pac script if provided.
|
// Refetches and applies the new pac script if provided.
|
||||||
|
@ -355,7 +355,7 @@ void SetProxyInIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
||||||
void SetCertVerifyProcInIO(
|
void SetCertVerifyProcInIO(
|
||||||
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
||||||
const AtomCertVerifier::VerifyProc& proc) {
|
const AtomCertVerifier::VerifyProc& proc) {
|
||||||
auto request_context = context_getter->GetURLRequestContext();
|
auto* request_context = context_getter->GetURLRequestContext();
|
||||||
static_cast<AtomCertVerifier*>(request_context->cert_verifier())
|
static_cast<AtomCertVerifier*>(request_context->cert_verifier())
|
||||||
->SetVerifyProc(proc);
|
->SetVerifyProc(proc);
|
||||||
}
|
}
|
||||||
|
@ -363,8 +363,8 @@ void SetCertVerifyProcInIO(
|
||||||
void ClearHostResolverCacheInIO(
|
void ClearHostResolverCacheInIO(
|
||||||
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
auto request_context = context_getter->GetURLRequestContext();
|
auto* request_context = context_getter->GetURLRequestContext();
|
||||||
auto cache = request_context->host_resolver()->GetHostCache();
|
auto* cache = request_context->host_resolver()->GetHostCache();
|
||||||
if (cache) {
|
if (cache) {
|
||||||
cache->clear();
|
cache->clear();
|
||||||
DCHECK_EQ(0u, cache->size());
|
DCHECK_EQ(0u, cache->size());
|
||||||
|
@ -377,12 +377,12 @@ void ClearAuthCacheInIO(
|
||||||
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
||||||
const ClearAuthCacheOptions& options,
|
const ClearAuthCacheOptions& options,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
auto request_context = context_getter->GetURLRequestContext();
|
auto* request_context = context_getter->GetURLRequestContext();
|
||||||
auto network_session =
|
auto* network_session =
|
||||||
request_context->http_transaction_factory()->GetSession();
|
request_context->http_transaction_factory()->GetSession();
|
||||||
if (network_session) {
|
if (network_session) {
|
||||||
if (options.type == "password") {
|
if (options.type == "password") {
|
||||||
auto auth_cache = network_session->http_auth_cache();
|
auto* auth_cache = network_session->http_auth_cache();
|
||||||
if (!options.origin.is_empty()) {
|
if (!options.origin.is_empty()) {
|
||||||
auth_cache->Remove(
|
auth_cache->Remove(
|
||||||
options.origin, options.realm, options.auth_scheme,
|
options.origin, options.realm, options.auth_scheme,
|
||||||
|
@ -391,7 +391,7 @@ void ClearAuthCacheInIO(
|
||||||
auth_cache->ClearEntriesAddedWithin(base::TimeDelta::Max());
|
auth_cache->ClearEntriesAddedWithin(base::TimeDelta::Max());
|
||||||
}
|
}
|
||||||
} else if (options.type == "clientCertificate") {
|
} else if (options.type == "clientCertificate") {
|
||||||
auto client_auth_cache = network_session->ssl_client_auth_cache();
|
auto* client_auth_cache = network_session->ssl_client_auth_cache();
|
||||||
client_auth_cache->Remove(net::HostPortPair::FromURL(options.origin));
|
client_auth_cache->Remove(net::HostPortPair::FromURL(options.origin));
|
||||||
}
|
}
|
||||||
network_session->CloseAllConnections();
|
network_session->CloseAllConnections();
|
||||||
|
@ -403,10 +403,10 @@ void ClearAuthCacheInIO(
|
||||||
void AllowNTLMCredentialsForDomainsInIO(
|
void AllowNTLMCredentialsForDomainsInIO(
|
||||||
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
|
||||||
const std::string& domains) {
|
const std::string& domains) {
|
||||||
auto request_context = context_getter->GetURLRequestContext();
|
auto* request_context = context_getter->GetURLRequestContext();
|
||||||
auto auth_handler = request_context->http_auth_handler_factory();
|
auto* auth_handler = request_context->http_auth_handler_factory();
|
||||||
if (auth_handler) {
|
if (auth_handler) {
|
||||||
auto auth_preferences = const_cast<net::HttpAuthPreferences*>(
|
auto* auth_preferences = const_cast<net::HttpAuthPreferences*>(
|
||||||
auth_handler->http_auth_preferences());
|
auth_handler->http_auth_preferences());
|
||||||
if (auth_preferences)
|
if (auth_preferences)
|
||||||
auth_preferences->set_server_whitelist(domains);
|
auth_preferences->set_server_whitelist(domains);
|
||||||
|
@ -453,7 +453,7 @@ void SetDevToolsNetworkEmulationClientIdInIO(
|
||||||
// Clear protocol handlers in IO thread.
|
// Clear protocol handlers in IO thread.
|
||||||
void ClearJobFactoryInIO(
|
void ClearJobFactoryInIO(
|
||||||
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter) {
|
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter) {
|
||||||
auto job_factory = static_cast<AtomURLRequestJobFactory*>(
|
auto* job_factory = static_cast<AtomURLRequestJobFactory*>(
|
||||||
request_context_getter->job_factory());
|
request_context_getter->job_factory());
|
||||||
if (job_factory)
|
if (job_factory)
|
||||||
job_factory->Clear();
|
job_factory->Clear();
|
||||||
|
@ -492,7 +492,7 @@ Session::Session(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::~Session() {
|
Session::~Session() {
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(ClearJobFactoryInIO, base::RetainedRef(getter)));
|
base::BindOnce(ClearJobFactoryInIO, base::RetainedRef(getter)));
|
||||||
|
@ -541,7 +541,7 @@ void Session::ClearStorageData(mate::Arguments* args) {
|
||||||
args->GetNext(&options);
|
args->GetNext(&options);
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
|
|
||||||
auto storage_partition =
|
auto* storage_partition =
|
||||||
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
|
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
|
||||||
if (options.storage_types & StoragePartition::REMOVE_DATA_MASK_COOKIES) {
|
if (options.storage_types & StoragePartition::REMOVE_DATA_MASK_COOKIES) {
|
||||||
// Reset media device id salt when cookies are cleared.
|
// Reset media device id salt when cookies are cleared.
|
||||||
|
@ -555,14 +555,14 @@ void Session::ClearStorageData(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::FlushStorageData() {
|
void Session::FlushStorageData() {
|
||||||
auto storage_partition =
|
auto* storage_partition =
|
||||||
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
|
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
|
||||||
storage_partition->Flush();
|
storage_partition->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::SetProxy(const net::ProxyConfig& config,
|
void Session::SetProxy(const net::ProxyConfig& config,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
auto getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
BrowserThread::PostTask(
|
BrowserThread::PostTask(
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(&SetProxyInIO, base::RetainedRef(getter), config,
|
base::BindOnce(&SetProxyInIO, base::RetainedRef(getter), config,
|
||||||
|
@ -631,7 +631,7 @@ void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
|
||||||
args->ThrowError("Must pass null or function");
|
args->ThrowError("Must pass null or function");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto permission_manager = static_cast<AtomPermissionManager*>(
|
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||||
browser_context()->GetPermissionManager());
|
browser_context()->GetPermissionManager());
|
||||||
permission_manager->SetPermissionRequestHandler(handler);
|
permission_manager->SetPermissionRequestHandler(handler);
|
||||||
}
|
}
|
||||||
|
@ -725,7 +725,7 @@ void Session::CreateInterruptedDownload(const mate::Dictionary& options) {
|
||||||
isolate(), "Must pass an offset value less than length.")));
|
isolate(), "Must pass an offset value less than length.")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto download_manager =
|
auto* download_manager =
|
||||||
content::BrowserContext::GetDownloadManager(browser_context());
|
content::BrowserContext::GetDownloadManager(browser_context());
|
||||||
download_manager->GetDelegate()->GetNextId(base::Bind(
|
download_manager->GetDelegate()->GetNextId(base::Bind(
|
||||||
&DownloadIdCallback, download_manager, path, url_chain, mime_type, offset,
|
&DownloadIdCallback, download_manager, path, url_chain, mime_type, offset,
|
||||||
|
@ -772,7 +772,7 @@ v8::Local<v8::Value> Session::WebRequest(v8::Isolate* isolate) {
|
||||||
// static
|
// static
|
||||||
mate::Handle<Session> Session::CreateFrom(v8::Isolate* isolate,
|
mate::Handle<Session> Session::CreateFrom(v8::Isolate* isolate,
|
||||||
AtomBrowserContext* browser_context) {
|
AtomBrowserContext* browser_context) {
|
||||||
auto existing = TrackableObject::FromWrappedClass(isolate, browser_context);
|
auto* existing = TrackableObject::FromWrappedClass(isolate, browser_context);
|
||||||
if (existing)
|
if (existing)
|
||||||
return mate::CreateHandle(isolate, static_cast<Session*>(existing));
|
return mate::CreateHandle(isolate, static_cast<Session*>(existing));
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Session : public mate::TrackableObject<Session>,
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Session(v8::Isolate* isolate, AtomBrowserContext* browser_context);
|
Session(v8::Isolate* isolate, AtomBrowserContext* browser_context);
|
||||||
~Session();
|
~Session() override;
|
||||||
|
|
||||||
// content::DownloadManager::Observer:
|
// content::DownloadManager::Observer:
|
||||||
void OnDownloadCreated(content::DownloadManager* manager,
|
void OnDownloadCreated(content::DownloadManager* manager,
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct Converter<scoped_refptr<const net::IOBufferWithSize>> {
|
||||||
*out = nullptr;
|
*out = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto data = node::Buffer::Data(val);
|
auto* data = node::Buffer::Data(val);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
// This is an error as size is positive but data is null.
|
// This is an error as size is positive but data is null.
|
||||||
return false;
|
return false;
|
||||||
|
@ -138,7 +138,7 @@ URLRequest::~URLRequest() {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
mate::WrappableBase* URLRequest::New(mate::Arguments* args) {
|
mate::WrappableBase* URLRequest::New(mate::Arguments* args) {
|
||||||
auto isolate = args->isolate();
|
auto* isolate = args->isolate();
|
||||||
v8::Local<v8::Object> options;
|
v8::Local<v8::Object> options;
|
||||||
args->GetNext(&options);
|
args->GetNext(&options);
|
||||||
mate::Dictionary dict(isolate, options);
|
mate::Dictionary dict(isolate, options);
|
||||||
|
@ -157,8 +157,8 @@ mate::WrappableBase* URLRequest::New(mate::Arguments* args) {
|
||||||
// Use the default session if not specified.
|
// Use the default session if not specified.
|
||||||
session = Session::FromPartition(isolate, "");
|
session = Session::FromPartition(isolate, "");
|
||||||
}
|
}
|
||||||
auto browser_context = session->browser_context();
|
auto* browser_context = session->browser_context();
|
||||||
auto api_url_request = new URLRequest(args->isolate(), args->GetThis());
|
auto* api_url_request = new URLRequest(args->isolate(), args->GetThis());
|
||||||
auto atom_url_request = AtomURLRequest::Create(
|
auto atom_url_request = AtomURLRequest::Create(
|
||||||
browser_context, method, url, redirect_policy, api_url_request);
|
browser_context, method, url, redirect_policy, api_url_request);
|
||||||
|
|
||||||
|
|
|
@ -275,12 +275,12 @@ namespace {
|
||||||
|
|
||||||
content::ServiceWorkerContext* GetServiceWorkerContext(
|
content::ServiceWorkerContext* GetServiceWorkerContext(
|
||||||
const content::WebContents* web_contents) {
|
const content::WebContents* web_contents) {
|
||||||
auto context = web_contents->GetBrowserContext();
|
auto* context = web_contents->GetBrowserContext();
|
||||||
auto site_instance = web_contents->GetSiteInstance();
|
auto* site_instance = web_contents->GetSiteInstance();
|
||||||
if (!context || !site_instance)
|
if (!context || !site_instance)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto storage_partition =
|
auto* storage_partition =
|
||||||
content::BrowserContext::GetStoragePartition(context, site_instance);
|
content::BrowserContext::GetStoragePartition(context, site_instance);
|
||||||
if (!storage_partition)
|
if (!storage_partition)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -486,7 +486,7 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
|
||||||
NativeWindow* owner_window = nullptr;
|
NativeWindow* owner_window = nullptr;
|
||||||
if (embedder_) {
|
if (embedder_) {
|
||||||
// New WebContents's owner_window is the embedder's owner_window.
|
// New WebContents's owner_window is the embedder's owner_window.
|
||||||
auto relay =
|
auto* relay =
|
||||||
NativeWindowRelay::FromWebContents(embedder_->web_contents());
|
NativeWindowRelay::FromWebContents(embedder_->web_contents());
|
||||||
if (relay)
|
if (relay)
|
||||||
owner_window = relay->window.get();
|
owner_window = relay->window.get();
|
||||||
|
@ -675,7 +675,8 @@ content::KeyboardEventProcessingResult WebContents::PreHandleKeyboardEvent(
|
||||||
|
|
||||||
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
||||||
const GURL& origin) {
|
const GURL& origin) {
|
||||||
auto permission_helper = WebContentsPermissionHelper::FromWebContents(source);
|
auto* permission_helper =
|
||||||
|
WebContentsPermissionHelper::FromWebContents(source);
|
||||||
auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab,
|
auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab,
|
||||||
base::Unretained(this), source, origin);
|
base::Unretained(this), source, origin);
|
||||||
permission_helper->RequestFullscreenPermission(callback);
|
permission_helper->RequestFullscreenPermission(callback);
|
||||||
|
@ -754,7 +755,7 @@ void WebContents::RequestMediaAccessPermission(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
const content::MediaStreamRequest& request,
|
const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback) {
|
const content::MediaResponseCallback& callback) {
|
||||||
auto permission_helper =
|
auto* permission_helper =
|
||||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||||
permission_helper->RequestMediaAccessPermission(request, callback);
|
permission_helper->RequestMediaAccessPermission(request, callback);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +763,7 @@ void WebContents::RequestMediaAccessPermission(
|
||||||
void WebContents::RequestToLockMouse(content::WebContents* web_contents,
|
void WebContents::RequestToLockMouse(content::WebContents* web_contents,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
bool last_unlocked_by_target) {
|
bool last_unlocked_by_target) {
|
||||||
auto permission_helper =
|
auto* permission_helper =
|
||||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||||
permission_helper->RequestPointerLockPermission(user_gesture);
|
permission_helper->RequestPointerLockPermission(user_gesture);
|
||||||
}
|
}
|
||||||
|
@ -789,7 +790,7 @@ void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::RenderViewCreated(content::RenderViewHost* render_view_host) {
|
void WebContents::RenderViewCreated(content::RenderViewHost* render_view_host) {
|
||||||
const auto impl = content::RenderWidgetHostImpl::FromID(
|
auto* const impl = content::RenderWidgetHostImpl::FromID(
|
||||||
render_view_host->GetProcess()->GetID(),
|
render_view_host->GetProcess()->GetID(),
|
||||||
render_view_host->GetRoutingID());
|
render_view_host->GetRoutingID());
|
||||||
if (impl)
|
if (impl)
|
||||||
|
@ -807,7 +808,7 @@ void WebContents::RenderProcessGone(base::TerminationStatus status) {
|
||||||
void WebContents::PluginCrashed(const base::FilePath& plugin_path,
|
void WebContents::PluginCrashed(const base::FilePath& plugin_path,
|
||||||
base::ProcessId plugin_pid) {
|
base::ProcessId plugin_pid) {
|
||||||
content::WebPluginInfo info;
|
content::WebPluginInfo info;
|
||||||
auto plugin_service = content::PluginService::GetInstance();
|
auto* plugin_service = content::PluginService::GetInstance();
|
||||||
plugin_service->GetPluginInfoByPath(plugin_path, &info);
|
plugin_service->GetPluginInfoByPath(plugin_path, &info);
|
||||||
Emit("plugin-crashed", info.name, info.version);
|
Emit("plugin-crashed", info.name, info.version);
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1130,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||||
// Set the background color of RenderWidgetHostView.
|
// Set the background color of RenderWidgetHostView.
|
||||||
// We have to call it right after LoadURL because the RenderViewHost is only
|
// We have to call it right after LoadURL because the RenderViewHost is only
|
||||||
// created after loading a page.
|
// created after loading a page.
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (view) {
|
if (view) {
|
||||||
auto* web_preferences = WebContentsPreferences::From(web_contents());
|
auto* web_preferences = WebContentsPreferences::From(web_contents());
|
||||||
std::string color_name;
|
std::string color_name;
|
||||||
|
@ -1143,8 +1144,8 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::DownloadURL(const GURL& url) {
|
void WebContents::DownloadURL(const GURL& url) {
|
||||||
auto browser_context = web_contents()->GetBrowserContext();
|
auto* browser_context = web_contents()->GetBrowserContext();
|
||||||
auto download_manager =
|
auto* download_manager =
|
||||||
content::BrowserContext::GetDownloadManager(browser_context);
|
content::BrowserContext::GetDownloadManager(browser_context);
|
||||||
|
|
||||||
download_manager->DownloadUrl(
|
download_manager->DownloadUrl(
|
||||||
|
@ -1223,7 +1224,7 @@ std::string WebContents::GetUserAgent() {
|
||||||
bool WebContents::SavePage(const base::FilePath& full_file_path,
|
bool WebContents::SavePage(const base::FilePath& full_file_path,
|
||||||
const content::SavePageType& save_type,
|
const content::SavePageType& save_type,
|
||||||
const SavePageHandler::SavePageCallback& callback) {
|
const SavePageHandler::SavePageCallback& callback) {
|
||||||
auto handler = new SavePageHandler(web_contents(), callback);
|
auto* handler = new SavePageHandler(web_contents(), callback);
|
||||||
return handler->Handle(full_file_path, save_type);
|
return handler->Handle(full_file_path, save_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1280,9 +1281,9 @@ void WebContents::EnableDeviceEmulation(
|
||||||
if (type_ == REMOTE)
|
if (type_ == REMOTE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto frame_host = web_contents()->GetMainFrame();
|
auto* frame_host = web_contents()->GetMainFrame();
|
||||||
if (frame_host) {
|
if (frame_host) {
|
||||||
auto widget_host =
|
auto* widget_host =
|
||||||
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
||||||
if (!widget_host)
|
if (!widget_host)
|
||||||
return;
|
return;
|
||||||
|
@ -1295,9 +1296,9 @@ void WebContents::DisableDeviceEmulation() {
|
||||||
if (type_ == REMOTE)
|
if (type_ == REMOTE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto frame_host = web_contents()->GetMainFrame();
|
auto* frame_host = web_contents()->GetMainFrame();
|
||||||
if (frame_host) {
|
if (frame_host) {
|
||||||
auto widget_host =
|
auto* widget_host =
|
||||||
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
||||||
if (!widget_host)
|
if (!widget_host)
|
||||||
return;
|
return;
|
||||||
|
@ -1343,7 +1344,7 @@ void WebContents::InspectServiceWorker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::HasServiceWorker(const base::Callback<void(bool)>& callback) {
|
void WebContents::HasServiceWorker(const base::Callback<void(bool)>& callback) {
|
||||||
auto context = GetServiceWorkerContext(web_contents());
|
auto* context = GetServiceWorkerContext(web_contents());
|
||||||
if (!context)
|
if (!context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1358,7 +1359,7 @@ void WebContents::HasServiceWorker(const base::Callback<void(bool)>& callback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto wrapped_callback = new WrappedCallback(callback);
|
auto* wrapped_callback = new WrappedCallback(callback);
|
||||||
|
|
||||||
context->CheckHasServiceWorker(
|
context->CheckHasServiceWorker(
|
||||||
web_contents()->GetLastCommittedURL(), GURL::EmptyGURL(),
|
web_contents()->GetLastCommittedURL(), GURL::EmptyGURL(),
|
||||||
|
@ -1367,7 +1368,7 @@ void WebContents::HasServiceWorker(const base::Callback<void(bool)>& callback) {
|
||||||
|
|
||||||
void WebContents::UnregisterServiceWorker(
|
void WebContents::UnregisterServiceWorker(
|
||||||
const base::Callback<void(bool)>& callback) {
|
const base::Callback<void(bool)>& callback) {
|
||||||
auto context = GetServiceWorkerContext(web_contents());
|
auto* context = GetServiceWorkerContext(web_contents());
|
||||||
if (!context)
|
if (!context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1393,7 +1394,7 @@ void WebContents::Print(mate::Arguments* args) {
|
||||||
args->ThrowError();
|
args->ThrowError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto print_view_manager_basic_ptr =
|
auto* print_view_manager_basic_ptr =
|
||||||
printing::PrintViewManagerBasic::FromWebContents(web_contents());
|
printing::PrintViewManagerBasic::FromWebContents(web_contents());
|
||||||
if (args->Length() == 2) {
|
if (args->Length() == 2) {
|
||||||
base::Callback<void(bool)> callback;
|
base::Callback<void(bool)> callback;
|
||||||
|
@ -1505,14 +1506,14 @@ void WebContents::StopFindInPage(content::StopFindAction action) {
|
||||||
|
|
||||||
void WebContents::ShowDefinitionForSelection() {
|
void WebContents::ShowDefinitionForSelection() {
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (view)
|
if (view)
|
||||||
view->ShowDefinitionForSelection();
|
view->ShowDefinitionForSelection();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::CopyImageAt(int x, int y) {
|
void WebContents::CopyImageAt(int x, int y) {
|
||||||
const auto host = web_contents()->GetMainFrame();
|
auto* const host = web_contents()->GetMainFrame();
|
||||||
if (host)
|
if (host)
|
||||||
host->CopyImageAt(x, y);
|
host->CopyImageAt(x, y);
|
||||||
}
|
}
|
||||||
|
@ -1544,7 +1545,7 @@ void WebContents::TabTraverse(bool reverse) {
|
||||||
bool WebContents::SendIPCMessage(bool all_frames,
|
bool WebContents::SendIPCMessage(bool all_frames,
|
||||||
const base::string16& channel,
|
const base::string16& channel,
|
||||||
const base::ListValue& args) {
|
const base::ListValue& args) {
|
||||||
auto frame_host = web_contents()->GetMainFrame();
|
auto* frame_host = web_contents()->GetMainFrame();
|
||||||
if (frame_host) {
|
if (frame_host) {
|
||||||
return frame_host->Send(new AtomFrameMsg_Message(
|
return frame_host->Send(new AtomFrameMsg_Message(
|
||||||
frame_host->GetRoutingID(), all_frames, channel, args));
|
frame_host->GetRoutingID(), all_frames, channel, args));
|
||||||
|
@ -1554,7 +1555,7 @@ bool WebContents::SendIPCMessage(bool all_frames,
|
||||||
|
|
||||||
void WebContents::SendInputEvent(v8::Isolate* isolate,
|
void WebContents::SendInputEvent(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> input_event) {
|
v8::Local<v8::Value> input_event) {
|
||||||
const auto view = static_cast<content::RenderWidgetHostViewBase*>(
|
auto* const view = static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
web_contents()->GetRenderWidgetHostView());
|
web_contents()->GetRenderWidgetHostView());
|
||||||
if (!view)
|
if (!view)
|
||||||
return;
|
return;
|
||||||
|
@ -1597,7 +1598,7 @@ void WebContents::BeginFrameSubscription(mate::Arguments* args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (view) {
|
if (view) {
|
||||||
std::unique_ptr<FrameSubscriber> frame_subscriber(
|
std::unique_ptr<FrameSubscriber> frame_subscriber(
|
||||||
new FrameSubscriber(isolate(), view, callback, only_dirty));
|
new FrameSubscriber(isolate(), view, callback, only_dirty));
|
||||||
|
@ -1606,7 +1607,7 @@ void WebContents::BeginFrameSubscription(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::EndFrameSubscription() {
|
void WebContents::EndFrameSubscription() {
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (view)
|
if (view)
|
||||||
view->EndFrameSubscription();
|
view->EndFrameSubscription();
|
||||||
}
|
}
|
||||||
|
@ -1659,7 +1660,7 @@ void WebContents::CapturePage(mate::Arguments* args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (!view) {
|
if (!view) {
|
||||||
callback.Run(gfx::Image());
|
callback.Run(gfx::Image());
|
||||||
return;
|
return;
|
||||||
|
@ -1787,7 +1788,7 @@ void WebContents::Invalidate() {
|
||||||
osr_rwhv->Invalidate();
|
osr_rwhv->Invalidate();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
const auto window = owner_window();
|
auto* const window = owner_window();
|
||||||
if (window)
|
if (window)
|
||||||
window->Invalidate();
|
window->Invalidate();
|
||||||
}
|
}
|
||||||
|
@ -1795,7 +1796,7 @@ void WebContents::Invalidate() {
|
||||||
|
|
||||||
gfx::Size WebContents::GetSizeForNewRenderView(content::WebContents* wc) const {
|
gfx::Size WebContents::GetSizeForNewRenderView(content::WebContents* wc) const {
|
||||||
if (IsOffScreen() && wc == web_contents()) {
|
if (IsOffScreen() && wc == web_contents()) {
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents());
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents());
|
||||||
if (relay) {
|
if (relay) {
|
||||||
return relay->window->GetSize();
|
return relay->window->GetSize();
|
||||||
}
|
}
|
||||||
|
@ -1877,7 +1878,7 @@ content::WebContents* WebContents::HostWebContents() {
|
||||||
void WebContents::SetEmbedder(const WebContents* embedder) {
|
void WebContents::SetEmbedder(const WebContents* embedder) {
|
||||||
if (embedder) {
|
if (embedder) {
|
||||||
NativeWindow* owner_window = nullptr;
|
NativeWindow* owner_window = nullptr;
|
||||||
auto relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
|
auto* relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
|
||||||
if (relay) {
|
if (relay) {
|
||||||
owner_window = relay->window.get();
|
owner_window = relay->window.get();
|
||||||
}
|
}
|
||||||
|
@ -2054,7 +2055,7 @@ mate::Handle<WebContents> WebContents::CreateFrom(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
content::WebContents* web_contents) {
|
content::WebContents* web_contents) {
|
||||||
// We have an existing WebContents object in JS.
|
// We have an existing WebContents object in JS.
|
||||||
auto existing = TrackableObject::FromWrappedClass(isolate, web_contents);
|
auto* existing = TrackableObject::FromWrappedClass(isolate, web_contents);
|
||||||
if (existing)
|
if (existing)
|
||||||
return mate::CreateHandle(isolate, static_cast<WebContents*>(existing));
|
return mate::CreateHandle(isolate, static_cast<WebContents*>(existing));
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
Type type);
|
Type type);
|
||||||
WebContents(v8::Isolate* isolate, const mate::Dictionary& options);
|
WebContents(v8::Isolate* isolate, const mate::Dictionary& options);
|
||||||
~WebContents();
|
~WebContents() override;
|
||||||
|
|
||||||
void InitWithSessionAndOptions(v8::Isolate* isolate,
|
void InitWithSessionAndOptions(v8::Isolate* isolate,
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace atom {
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
||||||
bool WebContents::IsFocused() const {
|
bool WebContents::IsFocused() const {
|
||||||
auto view = web_contents()->GetRenderWidgetHostView();
|
auto* view = web_contents()->GetRenderWidgetHostView();
|
||||||
if (!view) return false;
|
if (!view) return false;
|
||||||
|
|
||||||
if (GetType() != BACKGROUND_PAGE) {
|
if (GetType() != BACKGROUND_PAGE) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ void AddGuest(int guest_instance_id,
|
||||||
content::WebContents* embedder,
|
content::WebContents* embedder,
|
||||||
content::WebContents* guest_web_contents,
|
content::WebContents* guest_web_contents,
|
||||||
const base::DictionaryValue& options) {
|
const base::DictionaryValue& options) {
|
||||||
auto manager = atom::WebViewManager::GetWebViewManager(embedder);
|
auto* manager = atom::WebViewManager::GetWebViewManager(embedder);
|
||||||
if (manager)
|
if (manager)
|
||||||
manager->AddGuest(guest_instance_id, element_instance_id, embedder,
|
manager->AddGuest(guest_instance_id, element_instance_id, embedder,
|
||||||
guest_web_contents);
|
guest_web_contents);
|
||||||
|
@ -38,7 +38,7 @@ void AddGuest(int guest_instance_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveGuest(content::WebContents* embedder, int guest_instance_id) {
|
void RemoveGuest(content::WebContents* embedder, int guest_instance_id) {
|
||||||
auto manager = atom::WebViewManager::GetWebViewManager(embedder);
|
auto* manager = atom::WebViewManager::GetWebViewManager(embedder);
|
||||||
if (manager)
|
if (manager)
|
||||||
manager->RemoveGuest(guest_instance_id);
|
manager->RemoveGuest(guest_instance_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ void EventSubscriberBase::On(const std::string& event_name) {
|
||||||
v8::HandleScope handle_scope(isolate_);
|
v8::HandleScope handle_scope(isolate_);
|
||||||
auto fn_template = g_cached_template.Get(isolate_);
|
auto fn_template = g_cached_template.Get(isolate_);
|
||||||
auto event = mate::StringToV8(isolate_, event_name);
|
auto event = mate::StringToV8(isolate_, event_name);
|
||||||
auto js_handler_data = new JSHandlerData(isolate_, this);
|
auto* js_handler_data = new JSHandlerData(isolate_, this);
|
||||||
v8::Local<v8::Value> fn = internal::BindFunctionWith(
|
v8::Local<v8::Value> fn = internal::BindFunctionWith(
|
||||||
isolate_, isolate_->GetCurrentContext(), fn_template->GetFunction(),
|
isolate_, isolate_->GetCurrentContext(), fn_template->GetFunction(),
|
||||||
js_handler_data->handle_.Get(isolate_), event);
|
js_handler_data->handle_.Get(isolate_), event);
|
||||||
|
|
|
@ -27,6 +27,8 @@ FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
|
||||||
source_id_for_copy_request_(base::UnguessableToken::Create()),
|
source_id_for_copy_request_(base::UnguessableToken::Create()),
|
||||||
weak_factory_(this) {}
|
weak_factory_(this) {}
|
||||||
|
|
||||||
|
FrameSubscriber::~FrameSubscriber() = default;
|
||||||
|
|
||||||
bool FrameSubscriber::ShouldCaptureFrame(
|
bool FrameSubscriber::ShouldCaptureFrame(
|
||||||
const gfx::Rect& dirty_rect,
|
const gfx::Rect& dirty_rect,
|
||||||
base::TimeTicks present_time,
|
base::TimeTicks present_time,
|
||||||
|
@ -87,8 +89,8 @@ void FrameSubscriber::OnFrameDelivered(const FrameCaptureCallback& callback,
|
||||||
auto local_buffer = buffer.ToLocalChecked();
|
auto local_buffer = buffer.ToLocalChecked();
|
||||||
|
|
||||||
{
|
{
|
||||||
auto source = static_cast<const unsigned char*>(bitmap.getPixels());
|
auto* source = static_cast<const unsigned char*>(bitmap.getPixels());
|
||||||
auto target = node::Buffer::Data(local_buffer);
|
auto* target = node::Buffer::Data(local_buffer);
|
||||||
|
|
||||||
for (int y = 0; y < bitmap.height(); ++y) {
|
for (int y = 0; y < bitmap.height(); ++y) {
|
||||||
memcpy(target, source, rgb_row_size);
|
memcpy(target, source, rgb_row_size);
|
||||||
|
|
|
@ -27,6 +27,7 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
|
||||||
content::RenderWidgetHostView* view,
|
content::RenderWidgetHostView* view,
|
||||||
const FrameCaptureCallback& callback,
|
const FrameCaptureCallback& callback,
|
||||||
bool only_dirty);
|
bool only_dirty);
|
||||||
|
~FrameSubscriber() override;
|
||||||
|
|
||||||
bool ShouldCaptureFrame(const gfx::Rect& damage_rect,
|
bool ShouldCaptureFrame(const gfx::Rect& damage_rect,
|
||||||
base::TimeTicks present_time,
|
base::TimeTicks present_time,
|
||||||
|
|
|
@ -30,7 +30,7 @@ void SavePageHandler::OnDownloadCreated(content::DownloadManager* manager,
|
||||||
|
|
||||||
bool SavePageHandler::Handle(const base::FilePath& full_path,
|
bool SavePageHandler::Handle(const base::FilePath& full_path,
|
||||||
const content::SavePageType& save_type) {
|
const content::SavePageType& save_type) {
|
||||||
auto download_manager = content::BrowserContext::GetDownloadManager(
|
auto* download_manager = content::BrowserContext::GetDownloadManager(
|
||||||
web_contents_->GetBrowserContext());
|
web_contents_->GetBrowserContext());
|
||||||
download_manager->AddObserver(this);
|
download_manager->AddObserver(this);
|
||||||
// Chromium will create a 'foo_files' directory under the directory of saving
|
// Chromium will create a 'foo_files' directory under the directory of saving
|
||||||
|
|
|
@ -32,7 +32,7 @@ class SavePageHandler : public content::DownloadManager::Observer,
|
||||||
|
|
||||||
SavePageHandler(content::WebContents* web_contents,
|
SavePageHandler(content::WebContents* web_contents,
|
||||||
const SavePageCallback& callback);
|
const SavePageCallback& callback);
|
||||||
~SavePageHandler();
|
~SavePageHandler() override;
|
||||||
|
|
||||||
bool Handle(const base::FilePath& full_path,
|
bool Handle(const base::FilePath& full_path,
|
||||||
const content::SavePageType& save_type);
|
const content::SavePageType& save_type);
|
||||||
|
|
|
@ -54,7 +54,8 @@ void TrackableObjectBase::AttachAsUserData(base::SupportsUserData* wrapped) {
|
||||||
int32_t TrackableObjectBase::GetIDFromWrappedClass(
|
int32_t TrackableObjectBase::GetIDFromWrappedClass(
|
||||||
base::SupportsUserData* wrapped) {
|
base::SupportsUserData* wrapped) {
|
||||||
if (wrapped) {
|
if (wrapped) {
|
||||||
auto id = static_cast<IDUserData*>(wrapped->GetUserData(kTrackedObjectKey));
|
auto* id = static_cast<IDUserData*>(
|
||||||
|
wrapped->GetUserData(kTrackedObjectKey));
|
||||||
if (id)
|
if (id)
|
||||||
return *id;
|
return *id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace atom {
|
||||||
class AtomAccessTokenStore : public device::AccessTokenStore {
|
class AtomAccessTokenStore : public device::AccessTokenStore {
|
||||||
public:
|
public:
|
||||||
AtomAccessTokenStore() = default;
|
AtomAccessTokenStore() = default;
|
||||||
~AtomAccessTokenStore() = default;
|
|
||||||
|
|
||||||
// device::AccessTokenStore:
|
// device::AccessTokenStore:
|
||||||
void LoadAccessTokens(const LoadAccessTokensCallback& callback) override {}
|
void LoadAccessTokens(const LoadAccessTokensCallback& callback) override {}
|
||||||
|
@ -20,6 +19,7 @@ class AtomAccessTokenStore : public device::AccessTokenStore {
|
||||||
const base::string16& access_token) override {}
|
const base::string16& access_token) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
~AtomAccessTokenStore() override = default;
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore);
|
DISALLOW_COPY_AND_ASSIGN(AtomAccessTokenStore);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool AtomBrowserClient::ShouldCreateNewSiteInstance(
|
||||||
// a new SiteInstance
|
// a new SiteInstance
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto web_contents =
|
auto* web_contents =
|
||||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||||
if (!ChildWebContentsTracker::IsChildWebContents(web_contents)) {
|
if (!ChildWebContentsTracker::IsChildWebContents(web_contents)) {
|
||||||
// Root WebContents should always create new process to make sure
|
// Root WebContents should always create new process to make sure
|
||||||
|
@ -252,7 +252,7 @@ void AtomBrowserClient::OverrideSiteInstanceForNavigation(
|
||||||
site_per_affinities[affinity] = candidate_instance;
|
site_per_affinities[affinity] = candidate_instance;
|
||||||
*new_instance = candidate_instance;
|
*new_instance = candidate_instance;
|
||||||
// Remember the original web contents for the pending renderer process.
|
// Remember the original web contents for the pending renderer process.
|
||||||
auto pending_process = candidate_instance->GetProcess();
|
auto* pending_process = candidate_instance->GetProcess();
|
||||||
pending_processes_[pending_process->GetID()] = web_contents;
|
pending_processes_[pending_process->GetID()] = web_contents;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -272,7 +272,7 @@ void AtomBrowserClient::OverrideSiteInstanceForNavigation(
|
||||||
|
|
||||||
*new_instance = candidate_instance;
|
*new_instance = candidate_instance;
|
||||||
// Remember the original web contents for the pending renderer process.
|
// Remember the original web contents for the pending renderer process.
|
||||||
auto pending_process = candidate_instance->GetProcess();
|
auto* pending_process = candidate_instance->GetProcess();
|
||||||
pending_processes_[pending_process->GetID()] = web_contents;
|
pending_processes_[pending_process->GetID()] = web_contents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,8 +343,8 @@ void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) {
|
||||||
void AtomBrowserClient::GetGeolocationRequestContext(
|
void AtomBrowserClient::GetGeolocationRequestContext(
|
||||||
base::OnceCallback<void(scoped_refptr<net::URLRequestContextGetter>)>
|
base::OnceCallback<void(scoped_refptr<net::URLRequestContextGetter>)>
|
||||||
callback) {
|
callback) {
|
||||||
auto io_thread = AtomBrowserMainParts::Get()->io_thread();
|
auto* io_thread = AtomBrowserMainParts::Get()->io_thread();
|
||||||
auto context = io_thread->GetRequestContext();
|
auto* context = io_thread->GetRequestContext();
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::BindOnce(std::move(callback), base::RetainedRef(context)));
|
base::BindOnce(std::move(callback), base::RetainedRef(context)));
|
||||||
|
@ -483,7 +483,7 @@ void AtomBrowserClient::WebNotificationAllowed(
|
||||||
callback.Run(false, false);
|
callback.Run(false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto permission_helper =
|
auto* permission_helper =
|
||||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||||
if (!permission_helper) {
|
if (!permission_helper) {
|
||||||
callback.Run(false, false);
|
callback.Run(false, false);
|
||||||
|
|
|
@ -31,7 +31,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
||||||
public content::RenderProcessHostObserver {
|
public content::RenderProcessHostObserver {
|
||||||
public:
|
public:
|
||||||
AtomBrowserClient();
|
AtomBrowserClient();
|
||||||
virtual ~AtomBrowserClient();
|
~AtomBrowserClient() override;
|
||||||
|
|
||||||
using Delegate = content::ContentBrowserClient;
|
using Delegate = content::ContentBrowserClient;
|
||||||
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
|
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
|
||||||
|
|
|
@ -150,7 +150,7 @@ AtomBrowserContext::CreateURLRequestJobFactory(
|
||||||
url::kWssScheme,
|
url::kWssScheme,
|
||||||
base::WrapUnique(new HttpProtocolHandler(url::kWssScheme)));
|
base::WrapUnique(new HttpProtocolHandler(url::kWssScheme)));
|
||||||
|
|
||||||
auto host_resolver =
|
auto* host_resolver =
|
||||||
url_request_context_getter()->GetURLRequestContext()->host_resolver();
|
url_request_context_getter()->GetURLRequestContext()->host_resolver();
|
||||||
job_factory->SetProtocolHandler(
|
job_factory->SetProtocolHandler(
|
||||||
url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver));
|
url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver));
|
||||||
|
@ -171,7 +171,7 @@ AtomBrowserContext::CreateHttpCacheBackendFactory(
|
||||||
content::DownloadManagerDelegate*
|
content::DownloadManagerDelegate*
|
||||||
AtomBrowserContext::GetDownloadManagerDelegate() {
|
AtomBrowserContext::GetDownloadManagerDelegate() {
|
||||||
if (!download_manager_delegate_.get()) {
|
if (!download_manager_delegate_.get()) {
|
||||||
auto download_manager = content::BrowserContext::GetDownloadManager(this);
|
auto* download_manager = content::BrowserContext::GetDownloadManager(this);
|
||||||
download_manager_delegate_.reset(
|
download_manager_delegate_.reset(
|
||||||
new AtomDownloadManagerDelegate(download_manager));
|
new AtomDownloadManagerDelegate(download_manager));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class BridgeTaskRunner;
|
||||||
class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||||
public:
|
public:
|
||||||
AtomBrowserMainParts();
|
AtomBrowserMainParts();
|
||||||
virtual ~AtomBrowserMainParts();
|
~AtomBrowserMainParts() override;
|
||||||
|
|
||||||
static AtomBrowserMainParts* Get();
|
static AtomBrowserMainParts* Get();
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,13 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
|
||||||
const base::FilePath& default_path) {
|
const base::FilePath& default_path) {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
|
|
||||||
auto item = download_manager_->GetDownload(download_id);
|
auto* item = download_manager_->GetDownload(download_id);
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NativeWindow* window = nullptr;
|
NativeWindow* window = nullptr;
|
||||||
content::WebContents* web_contents = item->GetWebContents();
|
content::WebContents* web_contents = item->GetWebContents();
|
||||||
auto relay =
|
auto* relay =
|
||||||
web_contents ? NativeWindowRelay::FromWebContents(web_contents) : nullptr;
|
web_contents ? NativeWindowRelay::FromWebContents(web_contents) : nullptr;
|
||||||
if (relay)
|
if (relay)
|
||||||
window = relay->window.get();
|
window = relay->window.get();
|
||||||
|
|
|
@ -22,7 +22,7 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
|
||||||
base::Callback<void(const base::FilePath&)>;
|
base::Callback<void(const base::FilePath&)>;
|
||||||
|
|
||||||
explicit AtomDownloadManagerDelegate(content::DownloadManager* manager);
|
explicit AtomDownloadManagerDelegate(content::DownloadManager* manager);
|
||||||
virtual ~AtomDownloadManagerDelegate();
|
~AtomDownloadManagerDelegate() override;
|
||||||
|
|
||||||
void OnDownloadPathGenerated(uint32_t download_id,
|
void OnDownloadPathGenerated(uint32_t download_id,
|
||||||
const content::DownloadTargetCallback& callback,
|
const content::DownloadTargetCallback& callback,
|
||||||
|
|
|
@ -28,6 +28,7 @@ constexpr int kUserWantsNoMoreDialogs = -1;
|
||||||
AtomJavaScriptDialogManager::AtomJavaScriptDialogManager(
|
AtomJavaScriptDialogManager::AtomJavaScriptDialogManager(
|
||||||
api::WebContents* api_web_contents)
|
api::WebContents* api_web_contents)
|
||||||
: api_web_contents_(api_web_contents) {}
|
: api_web_contents_(api_web_contents) {}
|
||||||
|
AtomJavaScriptDialogManager::~AtomJavaScriptDialogManager() = default;
|
||||||
|
|
||||||
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
|
void AtomJavaScriptDialogManager::RunJavaScriptDialog(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
|
|
|
@ -19,6 +19,7 @@ class WebContents;
|
||||||
class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||||
public:
|
public:
|
||||||
explicit AtomJavaScriptDialogManager(api::WebContents* api_web_contents);
|
explicit AtomJavaScriptDialogManager(api::WebContents* api_web_contents);
|
||||||
|
~AtomJavaScriptDialogManager() override;
|
||||||
|
|
||||||
// content::JavaScriptDialogManager implementations.
|
// content::JavaScriptDialogManager implementations.
|
||||||
void RunJavaScriptDialog(content::WebContents* web_contents,
|
void RunJavaScriptDialog(content::WebContents* web_contents,
|
||||||
|
|
|
@ -76,7 +76,7 @@ void AtomPermissionManager::SetPermissionRequestHandler(
|
||||||
if (handler.is_null() && !pending_requests_.IsEmpty()) {
|
if (handler.is_null() && !pending_requests_.IsEmpty()) {
|
||||||
for (PendingRequestsMap::const_iterator iter(&pending_requests_);
|
for (PendingRequestsMap::const_iterator iter(&pending_requests_);
|
||||||
!iter.IsAtEnd(); iter.Advance()) {
|
!iter.IsAtEnd(); iter.Advance()) {
|
||||||
auto request = iter.GetCurrentValue();
|
auto* request = iter.GetCurrentValue();
|
||||||
if (!WebContentsDestroyed(request->render_process_id()))
|
if (!WebContentsDestroyed(request->render_process_id()))
|
||||||
request->RunCallback();
|
request->RunCallback();
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
|
||||||
return kNoPendingOperation;
|
return kNoPendingOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto web_contents =
|
auto* web_contents =
|
||||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||||
int request_id = pending_requests_.Add(std::make_unique<PendingRequest>(
|
int request_id = pending_requests_.Add(std::make_unique<PendingRequest>(
|
||||||
render_frame_host, permissions, response_callback));
|
render_frame_host, permissions, response_callback));
|
||||||
|
@ -175,7 +175,7 @@ void AtomPermissionManager::OnPermissionResponse(
|
||||||
int request_id,
|
int request_id,
|
||||||
int permission_id,
|
int permission_id,
|
||||||
blink::mojom::PermissionStatus status) {
|
blink::mojom::PermissionStatus status) {
|
||||||
auto pending_request = pending_requests_.Lookup(request_id);
|
auto* pending_request = pending_requests_.Lookup(request_id);
|
||||||
if (!pending_request)
|
if (!pending_request)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void AtomPermissionManager::OnPermissionResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomPermissionManager::CancelPermissionRequest(int request_id) {
|
void AtomPermissionManager::CancelPermissionRequest(int request_id) {
|
||||||
auto pending_request = pending_requests_.Lookup(request_id);
|
auto* pending_request = pending_requests_.Lookup(request_id);
|
||||||
if (!pending_request)
|
if (!pending_request)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ class AtomQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||||
typedef content::QuotaPermissionContext::QuotaPermissionResponse response;
|
typedef content::QuotaPermissionContext::QuotaPermissionResponse response;
|
||||||
|
|
||||||
AtomQuotaPermissionContext();
|
AtomQuotaPermissionContext();
|
||||||
virtual ~AtomQuotaPermissionContext();
|
|
||||||
|
|
||||||
// content::QuotaPermissionContext:
|
// content::QuotaPermissionContext:
|
||||||
void RequestQuotaPermission(const content::StorageQuotaParams& params,
|
void RequestQuotaPermission(const content::StorageQuotaParams& params,
|
||||||
|
@ -22,6 +21,8 @@ class AtomQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||||
const PermissionCallback& callback) override;
|
const PermissionCallback& callback) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
~AtomQuotaPermissionContext() override;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomQuotaPermissionContext);
|
DISALLOW_COPY_AND_ASSIGN(AtomQuotaPermissionContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ void HandleExternalProtocolInUI(
|
||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto permission_helper =
|
auto* permission_helper =
|
||||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||||
if (!permission_helper)
|
if (!permission_helper)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,7 +18,7 @@ class AtomSpeechRecognitionManagerDelegate
|
||||||
public content::SpeechRecognitionEventListener {
|
public content::SpeechRecognitionEventListener {
|
||||||
public:
|
public:
|
||||||
AtomSpeechRecognitionManagerDelegate();
|
AtomSpeechRecognitionManagerDelegate();
|
||||||
virtual ~AtomSpeechRecognitionManagerDelegate();
|
~AtomSpeechRecognitionManagerDelegate() override;
|
||||||
|
|
||||||
// content::SpeechRecognitionEventListener:
|
// content::SpeechRecognitionEventListener:
|
||||||
void OnRecognitionStart(int session_id) override;
|
void OnRecognitionStart(int session_id) override;
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AtomWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||||
static AtomWebUIControllerFactory* GetInstance();
|
static AtomWebUIControllerFactory* GetInstance();
|
||||||
|
|
||||||
AtomWebUIControllerFactory();
|
AtomWebUIControllerFactory();
|
||||||
virtual ~AtomWebUIControllerFactory();
|
~AtomWebUIControllerFactory() override;
|
||||||
|
|
||||||
// content::WebUIControllerFactory:
|
// content::WebUIControllerFactory:
|
||||||
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
||||||
|
|
|
@ -8,8 +8,11 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
BridgeTaskRunner::BridgeTaskRunner() = default;
|
||||||
|
BridgeTaskRunner::~BridgeTaskRunner() = default;
|
||||||
|
|
||||||
void BridgeTaskRunner::MessageLoopIsReady() {
|
void BridgeTaskRunner::MessageLoopIsReady() {
|
||||||
auto message_loop = base::MessageLoop::current();
|
auto* message_loop = base::MessageLoop::current();
|
||||||
CHECK(message_loop);
|
CHECK(message_loop);
|
||||||
for (TaskPair& task : tasks_) {
|
for (TaskPair& task : tasks_) {
|
||||||
message_loop->task_runner()->PostDelayedTask(
|
message_loop->task_runner()->PostDelayedTask(
|
||||||
|
@ -24,7 +27,7 @@ void BridgeTaskRunner::MessageLoopIsReady() {
|
||||||
bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
||||||
base::OnceClosure task,
|
base::OnceClosure task,
|
||||||
base::TimeDelta delay) {
|
base::TimeDelta delay) {
|
||||||
auto message_loop = base::MessageLoop::current();
|
auto* message_loop = base::MessageLoop::current();
|
||||||
if (!message_loop) {
|
if (!message_loop) {
|
||||||
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
|
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,7 +38,7 @@ bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BridgeTaskRunner::RunsTasksInCurrentSequence() const {
|
bool BridgeTaskRunner::RunsTasksInCurrentSequence() const {
|
||||||
auto message_loop = base::MessageLoop::current();
|
auto* message_loop = base::MessageLoop::current();
|
||||||
if (!message_loop)
|
if (!message_loop)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -46,7 +49,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
|
||||||
const base::Location& from_here,
|
const base::Location& from_here,
|
||||||
base::OnceClosure task,
|
base::OnceClosure task,
|
||||||
base::TimeDelta delay) {
|
base::TimeDelta delay) {
|
||||||
auto message_loop = base::MessageLoop::current();
|
auto* message_loop = base::MessageLoop::current();
|
||||||
if (!message_loop) {
|
if (!message_loop) {
|
||||||
non_nestable_tasks_.push_back(
|
non_nestable_tasks_.push_back(
|
||||||
std::make_tuple(from_here, std::move(task), delay));
|
std::make_tuple(from_here, std::move(task), delay));
|
||||||
|
|
|
@ -18,8 +18,7 @@ namespace atom {
|
||||||
// otherwise delay the work until message loop is ready.
|
// otherwise delay the work until message loop is ready.
|
||||||
class BridgeTaskRunner : public base::SingleThreadTaskRunner {
|
class BridgeTaskRunner : public base::SingleThreadTaskRunner {
|
||||||
public:
|
public:
|
||||||
BridgeTaskRunner() {}
|
BridgeTaskRunner();
|
||||||
~BridgeTaskRunner() override {}
|
|
||||||
|
|
||||||
// Called when message loop is ready.
|
// Called when message loop is ready.
|
||||||
void MessageLoopIsReady();
|
void MessageLoopIsReady();
|
||||||
|
@ -36,6 +35,8 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner {
|
||||||
private:
|
private:
|
||||||
using TaskPair =
|
using TaskPair =
|
||||||
std::tuple<base::Location, base::OnceClosure, base::TimeDelta>;
|
std::tuple<base::Location, base::OnceClosure, base::TimeDelta>;
|
||||||
|
~BridgeTaskRunner() override;
|
||||||
|
|
||||||
std::vector<TaskPair> tasks_;
|
std::vector<TaskPair> tasks_;
|
||||||
std::vector<TaskPair> non_nestable_tasks_;
|
std::vector<TaskPair> non_nestable_tasks_;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
Browser::LoginItemSettings::LoginItemSettings() = default;
|
||||||
|
Browser::LoginItemSettings::~LoginItemSettings() = default;
|
||||||
|
Browser::LoginItemSettings::LoginItemSettings(
|
||||||
|
const LoginItemSettings& other) = default;
|
||||||
|
|
||||||
Browser::Browser()
|
Browser::Browser()
|
||||||
: is_quiting_(false),
|
: is_quiting_(false),
|
||||||
is_exiting_(false),
|
is_exiting_(false),
|
||||||
|
|
|
@ -38,7 +38,7 @@ class LoginHandler;
|
||||||
class Browser : public WindowListObserver {
|
class Browser : public WindowListObserver {
|
||||||
public:
|
public:
|
||||||
Browser();
|
Browser();
|
||||||
~Browser();
|
~Browser() override;
|
||||||
|
|
||||||
static Browser* Get();
|
static Browser* Get();
|
||||||
|
|
||||||
|
@ -100,6 +100,10 @@ class Browser : public WindowListObserver {
|
||||||
bool opened_as_hidden = false;
|
bool opened_as_hidden = false;
|
||||||
base::string16 path;
|
base::string16 path;
|
||||||
std::vector<base::string16> args;
|
std::vector<base::string16> args;
|
||||||
|
|
||||||
|
LoginItemSettings();
|
||||||
|
~LoginItemSettings();
|
||||||
|
LoginItemSettings(const LoginItemSettings&);
|
||||||
};
|
};
|
||||||
void SetLoginItemSettings(LoginItemSettings settings);
|
void SetLoginItemSettings(LoginItemSettings settings);
|
||||||
LoginItemSettings GetLoginItemSettings(const LoginItemSettings& options);
|
LoginItemSettings GetLoginItemSettings(const LoginItemSettings& options);
|
||||||
|
|
|
@ -145,9 +145,13 @@ void Browser::SetUserActivity(const std::string& type,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Browser::GetCurrentActivityType() {
|
std::string Browser::GetCurrentActivityType() {
|
||||||
NSUserActivity* userActivity =
|
if (@available(macOS 10.10, *)) {
|
||||||
[[AtomApplication sharedApplication] getCurrentActivity];
|
NSUserActivity* userActivity =
|
||||||
return base::SysNSStringToUTF8(userActivity.activityType);
|
[[AtomApplication sharedApplication] getCurrentActivity];
|
||||||
|
return base::SysNSStringToUTF8(userActivity.activityType);
|
||||||
|
} else {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::InvalidateCurrentActivity() {
|
void Browser::InvalidateCurrentActivity() {
|
||||||
|
@ -256,7 +260,7 @@ std::string Browser::DockGetBadgeText() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::DockHide() {
|
void Browser::DockHide() {
|
||||||
for (const auto& window : WindowList::GetWindows())
|
for (auto* const& window : WindowList::GetWindows())
|
||||||
[window->GetNativeWindow() setCanHide:NO];
|
[window->GetNativeWindow() setCanHide:NO];
|
||||||
|
|
||||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct FileSystem {
|
||||||
|
|
||||||
std::string RegisterFileSystem(content::WebContents* web_contents,
|
std::string RegisterFileSystem(content::WebContents* web_contents,
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
auto isolated_context = storage::IsolatedContext::GetInstance();
|
auto* isolated_context = storage::IsolatedContext::GetInstance();
|
||||||
std::string root_name(kRootName);
|
std::string root_name(kRootName);
|
||||||
std::string file_system_id = isolated_context->RegisterFileSystemForPath(
|
std::string file_system_id = isolated_context->RegisterFileSystemForPath(
|
||||||
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
|
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
|
||||||
|
@ -113,13 +113,13 @@ void AppendToFile(const base::FilePath& path, const std::string& content) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PrefService* GetPrefService(content::WebContents* web_contents) {
|
PrefService* GetPrefService(content::WebContents* web_contents) {
|
||||||
auto context = web_contents->GetBrowserContext();
|
auto* context = web_contents->GetBrowserContext();
|
||||||
return static_cast<atom::AtomBrowserContext*>(context)->prefs();
|
return static_cast<atom::AtomBrowserContext*>(context)->prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::string> GetAddedFileSystemPaths(
|
std::set<std::string> GetAddedFileSystemPaths(
|
||||||
content::WebContents* web_contents) {
|
content::WebContents* web_contents) {
|
||||||
auto pref_service = GetPrefService(web_contents);
|
auto* pref_service = GetPrefService(web_contents);
|
||||||
const base::DictionaryValue* file_system_paths_value =
|
const base::DictionaryValue* file_system_paths_value =
|
||||||
pref_service->GetDictionary(prefs::kDevToolsFileSystemPaths);
|
pref_service->GetDictionary(prefs::kDevToolsFileSystemPaths);
|
||||||
std::set<std::string> result;
|
std::set<std::string> result;
|
||||||
|
@ -176,7 +176,7 @@ void CommonWebContentsDelegate::SetOwnerWindow(
|
||||||
NativeWindow* owner_window) {
|
NativeWindow* owner_window) {
|
||||||
owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr;
|
owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr;
|
||||||
auto relay = std::make_unique<NativeWindowRelay>(owner_window_);
|
auto relay = std::make_unique<NativeWindowRelay>(owner_window_);
|
||||||
auto relay_key = relay->key;
|
auto* relay_key = relay->key;
|
||||||
if (owner_window) {
|
if (owner_window) {
|
||||||
#if defined(TOOLKIT_VIEWS)
|
#if defined(TOOLKIT_VIEWS)
|
||||||
autofill_popup_.reset(new AutofillPopup());
|
autofill_popup_.reset(new AutofillPopup());
|
||||||
|
@ -383,7 +383,7 @@ void CommonWebContentsDelegate::DevToolsAddFileSystem(
|
||||||
std::unique_ptr<base::DictionaryValue> file_system_value(
|
std::unique_ptr<base::DictionaryValue> file_system_value(
|
||||||
CreateFileSystemValue(file_system));
|
CreateFileSystemValue(file_system));
|
||||||
|
|
||||||
auto pref_service = GetPrefService(GetDevToolsWebContents());
|
auto* pref_service = GetPrefService(GetDevToolsWebContents());
|
||||||
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
|
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
|
||||||
update.Get()->SetWithoutPathExpansion(path.AsUTF8Unsafe(),
|
update.Get()->SetWithoutPathExpansion(path.AsUTF8Unsafe(),
|
||||||
std::make_unique<base::Value>());
|
std::make_unique<base::Value>());
|
||||||
|
@ -401,7 +401,7 @@ void CommonWebContentsDelegate::DevToolsRemoveFileSystem(
|
||||||
storage::IsolatedContext::GetInstance()->RevokeFileSystemByPath(
|
storage::IsolatedContext::GetInstance()->RevokeFileSystemByPath(
|
||||||
file_system_path);
|
file_system_path);
|
||||||
|
|
||||||
auto pref_service = GetPrefService(GetDevToolsWebContents());
|
auto* pref_service = GetPrefService(GetDevToolsWebContents());
|
||||||
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
|
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
|
||||||
update.Get()->RemoveWithoutPathExpansion(path, nullptr);
|
update.Get()->RemoveWithoutPathExpansion(path, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class CommonWebContentsDelegate
|
||||||
public brightray::InspectableWebContentsViewDelegate {
|
public brightray::InspectableWebContentsViewDelegate {
|
||||||
public:
|
public:
|
||||||
CommonWebContentsDelegate();
|
CommonWebContentsDelegate();
|
||||||
virtual ~CommonWebContentsDelegate();
|
~CommonWebContentsDelegate() override;
|
||||||
|
|
||||||
// Creates a InspectableWebContents object and takes onwership of
|
// Creates a InspectableWebContents object and takes onwership of
|
||||||
// |web_contents|.
|
// |web_contents|.
|
||||||
|
|
|
@ -29,6 +29,8 @@ JavascriptEnvironment::JavascriptEnvironment()
|
||||||
context_(isolate_, v8::Context::New(isolate_)),
|
context_(isolate_, v8::Context::New(isolate_)),
|
||||||
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {}
|
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {}
|
||||||
|
|
||||||
|
JavascriptEnvironment::~JavascriptEnvironment() = default;
|
||||||
|
|
||||||
void JavascriptEnvironment::OnMessageLoopCreated() {
|
void JavascriptEnvironment::OnMessageLoopCreated() {
|
||||||
isolate_holder_.AddRunMicrotasksObserver();
|
isolate_holder_.AddRunMicrotasksObserver();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +40,7 @@ void JavascriptEnvironment::OnMessageLoopDestroying() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JavascriptEnvironment::Initialize() {
|
bool JavascriptEnvironment::Initialize() {
|
||||||
auto cmd = base::CommandLine::ForCurrentProcess();
|
auto* cmd = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
// --js-flags.
|
// --js-flags.
|
||||||
std::string js_flags = cmd->GetSwitchValueASCII(switches::kJavaScriptFlags);
|
std::string js_flags = cmd->GetSwitchValueASCII(switches::kJavaScriptFlags);
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace atom {
|
||||||
class JavascriptEnvironment {
|
class JavascriptEnvironment {
|
||||||
public:
|
public:
|
||||||
JavascriptEnvironment();
|
JavascriptEnvironment();
|
||||||
|
~JavascriptEnvironment();
|
||||||
|
|
||||||
void OnMessageLoopCreated();
|
void OnMessageLoopCreated();
|
||||||
void OnMessageLoopDestroying();
|
void OnMessageLoopDestroying();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
NSUserActivityDelegate> {
|
NSUserActivityDelegate> {
|
||||||
@private
|
@private
|
||||||
BOOL handlingSendEvent_;
|
BOOL handlingSendEvent_;
|
||||||
base::scoped_nsobject<NSUserActivity> currentActivity_;
|
base::scoped_nsobject<NSUserActivity> currentActivity_ API_AVAILABLE(macosx(10.10));
|
||||||
NSCondition* handoffLock_;
|
NSCondition* handoffLock_;
|
||||||
BOOL updateReceived_;
|
BOOL updateReceived_;
|
||||||
base::Callback<bool()> shouldShutdown_;
|
base::Callback<bool()> shouldShutdown_;
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
// CrAppControlProtocol:
|
// CrAppControlProtocol:
|
||||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
||||||
|
|
||||||
- (NSUserActivity*)getCurrentActivity;
|
- (NSUserActivity*)getCurrentActivity API_AVAILABLE(macosx(10.10));
|
||||||
- (void)setCurrentActivity:(NSString*)type
|
- (void)setCurrentActivity:(NSString*)type
|
||||||
withUserInfo:(NSDictionary*)userInfo
|
withUserInfo:(NSDictionary*)userInfo
|
||||||
withWebpageURL:(NSURL*)webpageURL;
|
withWebpageURL:(NSURL*)webpageURL;
|
||||||
|
|
|
@ -58,13 +58,15 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
- (void)setCurrentActivity:(NSString*)type
|
- (void)setCurrentActivity:(NSString*)type
|
||||||
withUserInfo:(NSDictionary*)userInfo
|
withUserInfo:(NSDictionary*)userInfo
|
||||||
withWebpageURL:(NSURL*)webpageURL {
|
withWebpageURL:(NSURL*)webpageURL {
|
||||||
currentActivity_ = base::scoped_nsobject<NSUserActivity>(
|
if (@available(macOS 10.10, *)) {
|
||||||
[[NSUserActivity alloc] initWithActivityType:type]);
|
currentActivity_ = base::scoped_nsobject<NSUserActivity>(
|
||||||
[currentActivity_ setUserInfo:userInfo];
|
[[NSUserActivity alloc] initWithActivityType:type]);
|
||||||
[currentActivity_ setWebpageURL:webpageURL];
|
[currentActivity_ setUserInfo:userInfo];
|
||||||
[currentActivity_ setDelegate:self];
|
[currentActivity_ setWebpageURL:webpageURL];
|
||||||
[currentActivity_ becomeCurrent];
|
[currentActivity_ setDelegate:self];
|
||||||
[currentActivity_ setNeedsSave:YES];
|
[currentActivity_ becomeCurrent];
|
||||||
|
[currentActivity_ setNeedsSave:YES];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUserActivity*)getCurrentActivity {
|
- (NSUserActivity*)getCurrentActivity {
|
||||||
|
@ -90,7 +92,7 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
[handoffLock_ unlock];
|
[handoffLock_ unlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)userActivityWillSave:(NSUserActivity *)userActivity {
|
- (void)userActivityWillSave:(NSUserActivity *)userActivity API_AVAILABLE(macosx(10.10)) {
|
||||||
__block BOOL shouldWait = NO;
|
__block BOOL shouldWait = NO;
|
||||||
dispatch_sync_main(^{
|
dispatch_sync_main(^{
|
||||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
|
@ -114,7 +116,7 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
[userActivity setNeedsSave:YES];
|
[userActivity setNeedsSave:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)userActivityWasContinued:(NSUserActivity *)userActivity {
|
- (void)userActivityWasContinued:(NSUserActivity *)userActivity API_AVAILABLE(macosx(10.10)) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
std::unique_ptr<base::DictionaryValue> user_info =
|
std::unique_ptr<base::DictionaryValue> user_info =
|
||||||
|
@ -165,7 +167,7 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateAccessibilityEnabled:(BOOL)enabled {
|
- (void)updateAccessibilityEnabled:(BOOL)enabled {
|
||||||
auto ax_state = content::BrowserAccessibilityState::GetInstance();
|
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
ax_state->OnScreenReaderDetected();
|
ax_state->OnScreenReaderDetected();
|
||||||
|
|
|
@ -96,7 +96,8 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication*)sender
|
- (BOOL)application:(NSApplication*)sender
|
||||||
continueUserActivity:(NSUserActivity*)userActivity
|
continueUserActivity:(NSUserActivity*)userActivity
|
||||||
restorationHandler:(void (^)(NSArray*restorableObjects))restorationHandler {
|
restorationHandler:(void (^)(NSArray*restorableObjects))restorationHandler
|
||||||
|
API_AVAILABLE(macosx(10.10)) {
|
||||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
std::unique_ptr<base::DictionaryValue> user_info =
|
std::unique_ptr<base::DictionaryValue> user_info =
|
||||||
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
||||||
|
|
|
@ -34,6 +34,10 @@ struct Transaction {
|
||||||
std::string errorMessage = "";
|
std::string errorMessage = "";
|
||||||
std::string transactionState = "";
|
std::string transactionState = "";
|
||||||
Payment payment;
|
Payment payment;
|
||||||
|
|
||||||
|
Transaction();
|
||||||
|
Transaction(const Transaction&);
|
||||||
|
~Transaction();
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------- Classes ---------------------------
|
// --------------------------- Classes ---------------------------
|
||||||
|
|
|
@ -174,6 +174,10 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
||||||
|
|
||||||
namespace in_app_purchase {
|
namespace in_app_purchase {
|
||||||
|
|
||||||
|
Transaction::Transaction() = default;
|
||||||
|
Transaction::Transaction(const Transaction&) = default;
|
||||||
|
Transaction::~Transaction() = default;
|
||||||
|
|
||||||
TransactionObserver::TransactionObserver() : weak_ptr_factory_(this) {
|
TransactionObserver::TransactionObserver() : weak_ptr_factory_(this) {
|
||||||
obeserver_ = [[InAppTransactionObserver alloc]
|
obeserver_ = [[InAppTransactionObserver alloc]
|
||||||
initWithCallback:base::Bind(&TransactionObserver::OnTransactionsUpdated,
|
initWithCallback:base::Bind(&TransactionObserver::OnTransactionsUpdated,
|
||||||
|
|
|
@ -30,6 +30,10 @@ struct Product {
|
||||||
|
|
||||||
// Downloadable Content Information
|
// Downloadable Content Information
|
||||||
bool downloadable = false;
|
bool downloadable = false;
|
||||||
|
|
||||||
|
Product(const Product&);
|
||||||
|
Product();
|
||||||
|
~Product();
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------- Typedefs ---------------------------
|
// --------------------------- Typedefs ---------------------------
|
||||||
|
|
|
@ -160,6 +160,10 @@
|
||||||
|
|
||||||
namespace in_app_purchase {
|
namespace in_app_purchase {
|
||||||
|
|
||||||
|
Product::Product() = default;
|
||||||
|
Product::Product(const Product&) = default;
|
||||||
|
Product::~Product() = default;
|
||||||
|
|
||||||
void GetProducts(const std::vector<std::string>& productIDs,
|
void GetProducts(const std::vector<std::string>& productIDs,
|
||||||
const InAppPurchaseProductsCallback& callback) {
|
const InAppPurchaseProductsCallback& callback) {
|
||||||
auto* iapProduct = [[InAppPurchaseProduct alloc] initWithCallback:callback];
|
auto* iapProduct = [[InAppPurchaseProduct alloc] initWithCallback:callback];
|
||||||
|
|
|
@ -25,6 +25,8 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
|
||||||
|
|
||||||
@implementation DragRegionView
|
@implementation DragRegionView
|
||||||
|
|
||||||
|
@synthesize initialLocation;
|
||||||
|
|
||||||
- (BOOL)mouseDownCanMoveWindow
|
- (BOOL)mouseDownCanMoveWindow
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -50,7 +52,9 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
|
||||||
postNotificationName:NSWindowWillMoveNotification
|
postNotificationName:NSWindowWillMoveNotification
|
||||||
object:self];
|
object:self];
|
||||||
|
|
||||||
[self.window performWindowDragWithEvent:event];
|
if (@available(macOS 10.11, *)) {
|
||||||
|
[self.window performWindowDragWithEvent:event];
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,10 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NativeWindow::IsClosed() const {
|
||||||
|
return is_closed_;
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
|
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
|
||||||
SetBounds(gfx::Rect(GetPosition(), size), animate);
|
SetBounds(gfx::Rect(GetPosition(), size), animate);
|
||||||
}
|
}
|
||||||
|
@ -505,4 +509,9 @@ void NativeWindow::NotifyWindowMessage(UINT message,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
|
||||||
|
: key(UserDataKey()), window(window) {}
|
||||||
|
|
||||||
|
NativeWindowRelay::~NativeWindowRelay() = default;
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -63,7 +63,7 @@ class NativeWindow : public base::SupportsUserData {
|
||||||
|
|
||||||
virtual void Close() = 0;
|
virtual void Close() = 0;
|
||||||
virtual void CloseImmediately() = 0;
|
virtual void CloseImmediately() = 0;
|
||||||
virtual bool IsClosed() const { return is_closed_; }
|
virtual bool IsClosed() const;
|
||||||
virtual void Focus(bool focus) = 0;
|
virtual void Focus(bool focus) = 0;
|
||||||
virtual bool IsFocused() = 0;
|
virtual bool IsFocused() = 0;
|
||||||
virtual void Show() = 0;
|
virtual void Show() = 0;
|
||||||
|
@ -323,8 +323,8 @@ class NativeWindow : public base::SupportsUserData {
|
||||||
class NativeWindowRelay
|
class NativeWindowRelay
|
||||||
: public content::WebContentsUserData<NativeWindowRelay> {
|
: public content::WebContentsUserData<NativeWindowRelay> {
|
||||||
public:
|
public:
|
||||||
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window)
|
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window);
|
||||||
: key(UserDataKey()), window(window) {}
|
~NativeWindowRelay() override;
|
||||||
|
|
||||||
static void* UserDataKey() {
|
static void* UserDataKey() {
|
||||||
return content::WebContentsUserData<NativeWindowRelay>::UserDataKey();
|
return content::WebContentsUserData<NativeWindowRelay>::UserDataKey();
|
||||||
|
|
|
@ -119,8 +119,8 @@ class NativeWindowMac : public NativeWindow {
|
||||||
void RefreshTouchBarItem(const std::string& item_id) override;
|
void RefreshTouchBarItem(const std::string& item_id) override;
|
||||||
void SetEscapeTouchBarItem(const mate::PersistentDictionary& item) override;
|
void SetEscapeTouchBarItem(const mate::PersistentDictionary& item) override;
|
||||||
|
|
||||||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
|
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
|
||||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
|
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
|
||||||
|
|
||||||
// Set the attribute of NSWindow while work around a bug of zoom button.
|
// Set the attribute of NSWindow while work around a bug of zoom button.
|
||||||
void SetStyleMask(bool on, NSUInteger flag);
|
void SetStyleMask(bool on, NSUInteger flag);
|
||||||
|
|
|
@ -314,59 +314,60 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
shell_->SetResizable(true);
|
shell_->SetResizable(true);
|
||||||
// Hide the native toolbar before entering fullscreen, so there is no visual
|
// Hide the native toolbar before entering fullscreen, so there is no visual
|
||||||
// artifacts.
|
// artifacts.
|
||||||
if (base::mac::IsAtLeastOS10_10() &&
|
if (@available(macOS 10.10, *)) {
|
||||||
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||||
NSWindow* window = shell_->GetNativeWindow();
|
NSWindow* window = shell_->GetNativeWindow();
|
||||||
[window setToolbar:nil];
|
[window setToolbar:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
|
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
|
||||||
shell_->NotifyWindowEnterFullScreen();
|
shell_->NotifyWindowEnterFullScreen();
|
||||||
|
|
||||||
// For frameless window we don't show set title for normal mode since the
|
if (@available(macOS 10.10, *)) {
|
||||||
// titlebar is expected to be empty, but after entering fullscreen mode we
|
// For frameless window we don't show set title for normal mode since the
|
||||||
// have to set one, because title bar is visible here.
|
// titlebar is expected to be empty, but after entering fullscreen mode we
|
||||||
NSWindow* window = shell_->GetNativeWindow();
|
// have to set one, because title bar is visible here.
|
||||||
if ((shell_->transparent() || !shell_->has_frame()) &&
|
NSWindow* window = shell_->GetNativeWindow();
|
||||||
base::mac::IsAtLeastOS10_10() &&
|
if ((shell_->transparent() || !shell_->has_frame()) &&
|
||||||
// FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under
|
// FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under
|
||||||
|
// fullscreen mode.
|
||||||
|
// Show title if fullscreen_window_title flag is set
|
||||||
|
(shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET ||
|
||||||
|
shell_->fullscreen_window_title())) {
|
||||||
|
[window setTitleVisibility:NSWindowTitleVisible];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore the native toolbar immediately after entering fullscreen, if we do
|
||||||
|
// this before leaving fullscreen, traffic light buttons will be jumping.
|
||||||
|
if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||||
|
base::scoped_nsobject<NSToolbar> toolbar(
|
||||||
|
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
||||||
|
[toolbar setShowsBaselineSeparator:NO];
|
||||||
|
[window setToolbar:toolbar];
|
||||||
|
|
||||||
|
// Set window style to hide the toolbar, otherwise the toolbar will show in
|
||||||
// fullscreen mode.
|
// fullscreen mode.
|
||||||
// Show title if fullscreen_window_title flag is set
|
shell_->SetStyleMask(true, NSFullSizeContentViewWindowMask);
|
||||||
(shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET ||
|
}
|
||||||
shell_->fullscreen_window_title())) {
|
|
||||||
[window setTitleVisibility:NSWindowTitleVisible];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore the native toolbar immediately after entering fullscreen, if we do
|
|
||||||
// this before leaving fullscreen, traffic light buttons will be jumping.
|
|
||||||
if (base::mac::IsAtLeastOS10_10() &&
|
|
||||||
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
|
||||||
base::scoped_nsobject<NSToolbar> toolbar(
|
|
||||||
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
|
||||||
[toolbar setShowsBaselineSeparator:NO];
|
|
||||||
[window setToolbar:toolbar];
|
|
||||||
|
|
||||||
// Set window style to hide the toolbar, otherwise the toolbar will show in
|
|
||||||
// fullscreen mode.
|
|
||||||
shell_->SetStyleMask(true, NSFullSizeContentViewWindowMask);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowWillExitFullScreen:(NSNotification*)notification {
|
- (void)windowWillExitFullScreen:(NSNotification*)notification {
|
||||||
// Restore the titlebar visibility.
|
if (@available(macOS 10.10, *)) {
|
||||||
NSWindow* window = shell_->GetNativeWindow();
|
// Restore the titlebar visibility.
|
||||||
if ((shell_->transparent() || !shell_->has_frame()) &&
|
NSWindow* window = shell_->GetNativeWindow();
|
||||||
base::mac::IsAtLeastOS10_10() &&
|
if ((shell_->transparent() || !shell_->has_frame()) &&
|
||||||
(shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET ||
|
(shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET ||
|
||||||
shell_->fullscreen_window_title())) {
|
shell_->fullscreen_window_title())) {
|
||||||
[window setTitleVisibility:NSWindowTitleHidden];
|
[window setTitleVisibility:NSWindowTitleHidden];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn off the style for toolbar.
|
// Turn off the style for toolbar.
|
||||||
if (base::mac::IsAtLeastOS10_10() &&
|
if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
||||||
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
|
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
|
||||||
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +425,9 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
|
|
||||||
@implementation AtomPreviewItem
|
@implementation AtomPreviewItem
|
||||||
|
|
||||||
|
@synthesize previewItemURL;
|
||||||
|
@synthesize previewItemTitle;
|
||||||
|
|
||||||
- (id)initWithURL:(NSURL*)url title:(NSString*)title {
|
- (id)initWithURL:(NSURL*)url title:(NSString*)title {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
@ -479,6 +483,13 @@ enum {
|
||||||
|
|
||||||
@implementation AtomNSWindow
|
@implementation AtomNSWindow
|
||||||
|
|
||||||
|
@synthesize acceptsFirstMouse;
|
||||||
|
@synthesize disableAutoHideCursor;
|
||||||
|
@synthesize disableKeyOrMainWindow;
|
||||||
|
@synthesize windowButtonsOffset;
|
||||||
|
@synthesize quickLookItem;
|
||||||
|
@synthesize vibrantView;
|
||||||
|
|
||||||
- (void)setShell:(atom::NativeWindowMac*)shell {
|
- (void)setShell:(atom::NativeWindowMac*)shell {
|
||||||
shell_ = shell;
|
shell_ = shell;
|
||||||
}
|
}
|
||||||
|
@ -487,7 +498,8 @@ enum {
|
||||||
enable_larger_than_screen_ = enable;
|
enable_larger_than_screen_ = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resetTouchBar:(const std::vector<mate::PersistentDictionary>&)settings {
|
- (void)resetTouchBar:(const std::vector<mate::PersistentDictionary>&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2)) {
|
||||||
if (![self respondsToSelector:@selector(touchBar)]) return;
|
if (![self respondsToSelector:@selector(touchBar)]) return;
|
||||||
|
|
||||||
atom_touch_bar_.reset([[AtomTouchBar alloc] initWithDelegate:self
|
atom_touch_bar_.reset([[AtomTouchBar alloc] initWithDelegate:self
|
||||||
|
@ -496,12 +508,13 @@ enum {
|
||||||
self.touchBar = nil;
|
self.touchBar = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)refreshTouchBarItem:(const std::string&)item_id {
|
- (void)refreshTouchBarItem:(const std::string&)item_id
|
||||||
|
API_AVAILABLE(macosx(10.12.2)) {
|
||||||
if (atom_touch_bar_ && self.touchBar)
|
if (atom_touch_bar_ && self.touchBar)
|
||||||
[atom_touch_bar_ refreshTouchBarItem:self.touchBar id:item_id];
|
[atom_touch_bar_ refreshTouchBarItem:self.touchBar id:item_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTouchBar*)makeTouchBar {
|
- (NSTouchBar*)makeTouchBar API_AVAILABLE(macosx(10.12.2)) {
|
||||||
if (atom_touch_bar_)
|
if (atom_touch_bar_)
|
||||||
return [atom_touch_bar_ makeTouchBar];
|
return [atom_touch_bar_ makeTouchBar];
|
||||||
else
|
else
|
||||||
|
@ -509,14 +522,15 @@ enum {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
|
- (NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
|
||||||
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier {
|
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macosx(10.12.2)) {
|
||||||
if (touchBar && atom_touch_bar_)
|
if (touchBar && atom_touch_bar_)
|
||||||
return [atom_touch_bar_ makeItemForIdentifier:identifier];
|
return [atom_touch_bar_ makeItemForIdentifier:identifier];
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item {
|
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item
|
||||||
|
API_AVAILABLE(macosx(10.12.2)) {
|
||||||
if (atom_touch_bar_ && self.touchBar)
|
if (atom_touch_bar_ && self.touchBar)
|
||||||
[atom_touch_bar_ setEscapeTouchBarItem:item forTouchBar:self.touchBar];
|
[atom_touch_bar_ setEscapeTouchBarItem:item forTouchBar:self.touchBar];
|
||||||
}
|
}
|
||||||
|
@ -828,10 +842,11 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUInteger styleMask = NSTitledWindowMask;
|
NSUInteger styleMask = NSTitledWindowMask;
|
||||||
if (title_bar_style_ == CUSTOM_BUTTONS_ON_HOVER &&
|
if (@available(macOS 10.10, *)) {
|
||||||
base::mac::IsAtLeastOS10_10() &&
|
if (title_bar_style_ == CUSTOM_BUTTONS_ON_HOVER &&
|
||||||
(!useStandardWindow || transparent() || !has_frame())) {
|
(!useStandardWindow || transparent() || !has_frame())) {
|
||||||
styleMask = NSFullSizeContentViewWindowMask;
|
styleMask = NSFullSizeContentViewWindowMask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (minimizable) {
|
if (minimizable) {
|
||||||
styleMask |= NSMiniaturizableWindowMask;
|
styleMask |= NSMiniaturizableWindowMask;
|
||||||
|
@ -885,7 +900,7 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
[window_ setDisableKeyOrMainWindow:YES];
|
[window_ setDisableKeyOrMainWindow:YES];
|
||||||
|
|
||||||
if (transparent() || !has_frame()) {
|
if (transparent() || !has_frame()) {
|
||||||
if (base::mac::IsAtLeastOS10_10()) {
|
if (@available(macOS 10.10, *)) {
|
||||||
// Don't show title bar.
|
// Don't show title bar.
|
||||||
[window_ setTitlebarAppearsTransparent:YES];
|
[window_ setTitlebarAppearsTransparent:YES];
|
||||||
[window_ setTitleVisibility:NSWindowTitleHidden];
|
[window_ setTitleVisibility:NSWindowTitleHidden];
|
||||||
|
@ -897,11 +912,11 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
// Create a tab only if tabbing identifier is specified and window has
|
// Create a tab only if tabbing identifier is specified and window has
|
||||||
// a native title bar.
|
// a native title bar.
|
||||||
if (tabbingIdentifier.empty() || transparent() || !has_frame()) {
|
if (tabbingIdentifier.empty() || transparent() || !has_frame()) {
|
||||||
if ([window_ respondsToSelector:@selector(tabbingMode)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ setTabbingMode:NSWindowTabbingModeDisallowed];
|
[window_ setTabbingMode:NSWindowTabbingModeDisallowed];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ([window_ respondsToSelector:@selector(tabbingIdentifier)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbingIdentifier)];
|
[window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbingIdentifier)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,14 +926,14 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
|
|
||||||
// Hide the title bar background
|
// Hide the title bar background
|
||||||
if (title_bar_style_ != NORMAL) {
|
if (title_bar_style_ != NORMAL) {
|
||||||
if (base::mac::IsAtLeastOS10_10()) {
|
if (@available(macOS 10.10, *)) {
|
||||||
[window_ setTitlebarAppearsTransparent:YES];
|
[window_ setTitlebarAppearsTransparent:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide the title bar.
|
// Hide the title bar.
|
||||||
if (title_bar_style_ == HIDDEN_INSET) {
|
if (title_bar_style_ == HIDDEN_INSET) {
|
||||||
if (base::mac::IsAtLeastOS10_10()) {
|
if (@available(macOS 10.10, *)) {
|
||||||
base::scoped_nsobject<NSToolbar> toolbar(
|
base::scoped_nsobject<NSToolbar> toolbar(
|
||||||
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
|
||||||
[toolbar setShowsBaselineSeparator:NO];
|
[toolbar setShowsBaselineSeparator:NO];
|
||||||
|
@ -1650,31 +1665,31 @@ void NativeWindowMac::SetAutoHideCursor(bool auto_hide) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SelectPreviousTab() {
|
void NativeWindowMac::SelectPreviousTab() {
|
||||||
if ([window_ respondsToSelector:@selector(selectPreviousTab:)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ selectPreviousTab:nil];
|
[window_ selectPreviousTab:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SelectNextTab() {
|
void NativeWindowMac::SelectNextTab() {
|
||||||
if ([window_ respondsToSelector:@selector(selectNextTab:)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ selectNextTab:nil];
|
[window_ selectNextTab:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::MergeAllWindows() {
|
void NativeWindowMac::MergeAllWindows() {
|
||||||
if ([window_ respondsToSelector:@selector(mergeAllWindows:)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ mergeAllWindows:nil];
|
[window_ mergeAllWindows:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::MoveTabToNewWindow() {
|
void NativeWindowMac::MoveTabToNewWindow() {
|
||||||
if ([window_ respondsToSelector:@selector(moveTabToNewWindow:)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ moveTabToNewWindow:nil];
|
[window_ moveTabToNewWindow:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::ToggleTabBar() {
|
void NativeWindowMac::ToggleTabBar() {
|
||||||
if ([window_ respondsToSelector:@selector(toggleTabBar:)]) {
|
if (@available(macOS 10.12, *)) {
|
||||||
[window_ toggleTabBar:nil];
|
[window_ toggleTabBar:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1683,91 +1698,91 @@ bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
|
||||||
if (window_.get() == window->GetNativeWindow()) {
|
if (window_.get() == window->GetNativeWindow()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if ([window_ respondsToSelector:@selector(addTabbedWindow:ordered:)])
|
if (@available(macOS 10.12, *))
|
||||||
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];
|
[window_ addTabbedWindow:window->GetNativeWindow() ordered:NSWindowAbove];
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetVibrancy(const std::string& type) {
|
void NativeWindowMac::SetVibrancy(const std::string& type) {
|
||||||
if (!base::mac::IsAtLeastOS10_10()) return;
|
if (@available(macOS 10.10, *)) {
|
||||||
|
NSView* vibrant_view = [window_ vibrantView];
|
||||||
|
|
||||||
NSView* vibrant_view = [window_ vibrantView];
|
if (type.empty()) {
|
||||||
|
if (background_color_before_vibrancy_) {
|
||||||
|
[window_ setBackgroundColor:background_color_before_vibrancy_];
|
||||||
|
[window_ setTitlebarAppearsTransparent:transparency_before_vibrancy_];
|
||||||
|
}
|
||||||
|
if (vibrant_view == nil) return;
|
||||||
|
|
||||||
if (type.empty()) {
|
[vibrant_view removeFromSuperview];
|
||||||
if (background_color_before_vibrancy_) {
|
[window_ setVibrantView:nil];
|
||||||
[window_ setBackgroundColor:background_color_before_vibrancy_];
|
ui::GpuSwitchingManager::SetTransparent(transparent());
|
||||||
[window_ setTitlebarAppearsTransparent:transparency_before_vibrancy_];
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (vibrant_view == nil) return;
|
|
||||||
|
|
||||||
[vibrant_view removeFromSuperview];
|
background_color_before_vibrancy_.reset([[window_ backgroundColor] retain]);
|
||||||
[window_ setVibrantView:nil];
|
transparency_before_vibrancy_ = [window_ titlebarAppearsTransparent];
|
||||||
ui::GpuSwitchingManager::SetTransparent(transparent());
|
ui::GpuSwitchingManager::SetTransparent(true);
|
||||||
|
|
||||||
return;
|
if (title_bar_style_ != NORMAL) {
|
||||||
}
|
[window_ setTitlebarAppearsTransparent:YES];
|
||||||
|
[window_ setBackgroundColor:[NSColor clearColor]];
|
||||||
background_color_before_vibrancy_.reset([[window_ backgroundColor] retain]);
|
|
||||||
transparency_before_vibrancy_ = [window_ titlebarAppearsTransparent];
|
|
||||||
ui::GpuSwitchingManager::SetTransparent(true);
|
|
||||||
|
|
||||||
if (title_bar_style_ != NORMAL) {
|
|
||||||
[window_ setTitlebarAppearsTransparent:YES];
|
|
||||||
[window_ setBackgroundColor:[NSColor clearColor]];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSVisualEffectView* effect_view = (NSVisualEffectView*)vibrant_view;
|
|
||||||
if (effect_view == nil) {
|
|
||||||
effect_view = [[[NSVisualEffectView alloc]
|
|
||||||
initWithFrame: [[window_ contentView] bounds]] autorelease];
|
|
||||||
[window_ setVibrantView:(NSView*)effect_view];
|
|
||||||
|
|
||||||
[effect_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
|
||||||
[effect_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
|
|
||||||
[effect_view setState:NSVisualEffectStateActive];
|
|
||||||
[[window_ contentView] addSubview:effect_view
|
|
||||||
positioned:NSWindowBelow
|
|
||||||
relativeTo:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSVisualEffectMaterial vibrancyType = NSVisualEffectMaterialLight;
|
|
||||||
|
|
||||||
if (type == "appearance-based") {
|
|
||||||
vibrancyType = NSVisualEffectMaterialAppearanceBased;
|
|
||||||
} else if (type == "light") {
|
|
||||||
vibrancyType = NSVisualEffectMaterialLight;
|
|
||||||
} else if (type == "dark") {
|
|
||||||
vibrancyType = NSVisualEffectMaterialDark;
|
|
||||||
} else if (type == "titlebar") {
|
|
||||||
vibrancyType = NSVisualEffectMaterialTitlebar;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (base::mac::IsAtLeastOS10_11()) {
|
|
||||||
// TODO(kevinsawicki): Use NSVisualEffectMaterial* constants directly once
|
|
||||||
// they are available in the minimum SDK version
|
|
||||||
if (type == "selection") {
|
|
||||||
// NSVisualEffectMaterialSelection
|
|
||||||
vibrancyType = static_cast<NSVisualEffectMaterial>(4);
|
|
||||||
} else if (type == "menu") {
|
|
||||||
// NSVisualEffectMaterialMenu
|
|
||||||
vibrancyType = static_cast<NSVisualEffectMaterial>(5);
|
|
||||||
} else if (type == "popover") {
|
|
||||||
// NSVisualEffectMaterialPopover
|
|
||||||
vibrancyType = static_cast<NSVisualEffectMaterial>(6);
|
|
||||||
} else if (type == "sidebar") {
|
|
||||||
// NSVisualEffectMaterialSidebar
|
|
||||||
vibrancyType = static_cast<NSVisualEffectMaterial>(7);
|
|
||||||
} else if (type == "medium-light") {
|
|
||||||
// NSVisualEffectMaterialMediumLight
|
|
||||||
vibrancyType = static_cast<NSVisualEffectMaterial>(8);
|
|
||||||
} else if (type == "ultra-dark") {
|
|
||||||
// NSVisualEffectMaterialUltraDark
|
|
||||||
vibrancyType = static_cast<NSVisualEffectMaterial>(9);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[effect_view setMaterial:vibrancyType];
|
NSVisualEffectView* effect_view = (NSVisualEffectView*)vibrant_view;
|
||||||
|
if (effect_view == nil) {
|
||||||
|
effect_view = [[[NSVisualEffectView alloc]
|
||||||
|
initWithFrame: [[window_ contentView] bounds]] autorelease];
|
||||||
|
[window_ setVibrantView:(NSView*)effect_view];
|
||||||
|
|
||||||
|
[effect_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
[effect_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
|
||||||
|
[effect_view setState:NSVisualEffectStateActive];
|
||||||
|
[[window_ contentView] addSubview:effect_view
|
||||||
|
positioned:NSWindowBelow
|
||||||
|
relativeTo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSVisualEffectMaterial vibrancyType = NSVisualEffectMaterialLight;
|
||||||
|
|
||||||
|
if (type == "appearance-based") {
|
||||||
|
vibrancyType = NSVisualEffectMaterialAppearanceBased;
|
||||||
|
} else if (type == "light") {
|
||||||
|
vibrancyType = NSVisualEffectMaterialLight;
|
||||||
|
} else if (type == "dark") {
|
||||||
|
vibrancyType = NSVisualEffectMaterialDark;
|
||||||
|
} else if (type == "titlebar") {
|
||||||
|
vibrancyType = NSVisualEffectMaterialTitlebar;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (@available(macOS 10.11, *)) {
|
||||||
|
// TODO(kevinsawicki): Use NSVisualEffectMaterial* constants directly once
|
||||||
|
// they are available in the minimum SDK version
|
||||||
|
if (type == "selection") {
|
||||||
|
// NSVisualEffectMaterialSelection
|
||||||
|
vibrancyType = static_cast<NSVisualEffectMaterial>(4);
|
||||||
|
} else if (type == "menu") {
|
||||||
|
// NSVisualEffectMaterialMenu
|
||||||
|
vibrancyType = static_cast<NSVisualEffectMaterial>(5);
|
||||||
|
} else if (type == "popover") {
|
||||||
|
// NSVisualEffectMaterialPopover
|
||||||
|
vibrancyType = static_cast<NSVisualEffectMaterial>(6);
|
||||||
|
} else if (type == "sidebar") {
|
||||||
|
// NSVisualEffectMaterialSidebar
|
||||||
|
vibrancyType = static_cast<NSVisualEffectMaterial>(7);
|
||||||
|
} else if (type == "medium-light") {
|
||||||
|
// NSVisualEffectMaterialMediumLight
|
||||||
|
vibrancyType = static_cast<NSVisualEffectMaterial>(8);
|
||||||
|
} else if (type == "ultra-dark") {
|
||||||
|
// NSVisualEffectMaterialUltraDark
|
||||||
|
vibrancyType = static_cast<NSVisualEffectMaterial>(9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[effect_view setMaterial:vibrancyType];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetTouchBar(
|
void NativeWindowMac::SetTouchBar(
|
||||||
|
|
|
@ -18,7 +18,7 @@ class AsarProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
|
||||||
public:
|
public:
|
||||||
explicit AsarProtocolHandler(
|
explicit AsarProtocolHandler(
|
||||||
const scoped_refptr<base::TaskRunner>& file_task_runner);
|
const scoped_refptr<base::TaskRunner>& file_task_runner);
|
||||||
virtual ~AsarProtocolHandler();
|
~AsarProtocolHandler() override;
|
||||||
|
|
||||||
// net::URLRequestJobFactory::ProtocolHandler:
|
// net::URLRequestJobFactory::ProtocolHandler:
|
||||||
net::URLRequestJob* MaybeCreateJob(
|
net::URLRequestJob* MaybeCreateJob(
|
||||||
|
|
|
@ -42,7 +42,7 @@ class URLRequestAsarJob : public net::URLRequestJob {
|
||||||
const base::FilePath& file_path);
|
const base::FilePath& file_path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~URLRequestAsarJob();
|
~URLRequestAsarJob() override;
|
||||||
|
|
||||||
void InitializeAsarJob(const scoped_refptr<base::TaskRunner> file_task_runner,
|
void InitializeAsarJob(const scoped_refptr<base::TaskRunner> file_task_runner,
|
||||||
std::shared_ptr<Archive> archive,
|
std::shared_ptr<Archive> archive,
|
||||||
|
|
|
@ -19,6 +19,10 @@ using content::BrowserThread;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
VerifyRequestParams::VerifyRequestParams() = default;
|
||||||
|
VerifyRequestParams::~VerifyRequestParams() = default;
|
||||||
|
VerifyRequestParams::VerifyRequestParams(const VerifyRequestParams&) = default;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class Response : public base::LinkNode<Response> {
|
class Response : public base::LinkNode<Response> {
|
||||||
|
|
|
@ -26,12 +26,16 @@ struct VerifyRequestParams {
|
||||||
std::string default_result;
|
std::string default_result;
|
||||||
int error_code;
|
int error_code;
|
||||||
scoped_refptr<net::X509Certificate> certificate;
|
scoped_refptr<net::X509Certificate> certificate;
|
||||||
|
|
||||||
|
VerifyRequestParams();
|
||||||
|
VerifyRequestParams(const VerifyRequestParams&);
|
||||||
|
~VerifyRequestParams();
|
||||||
};
|
};
|
||||||
|
|
||||||
class AtomCertVerifier : public net::CertVerifier {
|
class AtomCertVerifier : public net::CertVerifier {
|
||||||
public:
|
public:
|
||||||
explicit AtomCertVerifier(brightray::RequireCTDelegate* ct_delegate);
|
explicit AtomCertVerifier(brightray::RequireCTDelegate* ct_delegate);
|
||||||
virtual ~AtomCertVerifier();
|
~AtomCertVerifier() override;
|
||||||
|
|
||||||
using VerifyProc = base::Callback<void(const VerifyRequestParams& request,
|
using VerifyProc = base::Callback<void(const VerifyRequestParams& request,
|
||||||
const net::CompletionCallback&)>;
|
const net::CompletionCallback&)>;
|
||||||
|
|
|
@ -197,7 +197,7 @@ void ReadFromResponseObject(const base::DictionaryValue& response,
|
||||||
if (!response.GetString("statusLine", &status_line))
|
if (!response.GetString("statusLine", &status_line))
|
||||||
status_line = container.second;
|
status_line = container.second;
|
||||||
if (response.GetDictionary("responseHeaders", &dict)) {
|
if (response.GetDictionary("responseHeaders", &dict)) {
|
||||||
auto headers = container.first;
|
auto* headers = container.first;
|
||||||
*headers = new net::HttpResponseHeaders("");
|
*headers = new net::HttpResponseHeaders("");
|
||||||
(*headers)->ReplaceStatusLine(status_line);
|
(*headers)->ReplaceStatusLine(status_line);
|
||||||
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
|
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
|
||||||
|
@ -217,6 +217,20 @@ void ReadFromResponseObject(const base::DictionaryValue& response,
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo(
|
||||||
|
URLPatterns patterns_,
|
||||||
|
SimpleListener listener_)
|
||||||
|
: url_patterns(patterns_), listener(listener_) {}
|
||||||
|
AtomNetworkDelegate::SimpleListenerInfo::SimpleListenerInfo() = default;
|
||||||
|
AtomNetworkDelegate::SimpleListenerInfo::~SimpleListenerInfo() = default;
|
||||||
|
|
||||||
|
AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo(
|
||||||
|
URLPatterns patterns_,
|
||||||
|
ResponseListener listener_)
|
||||||
|
: url_patterns(patterns_), listener(listener_) {}
|
||||||
|
AtomNetworkDelegate::ResponseListenerInfo::ResponseListenerInfo() = default;
|
||||||
|
AtomNetworkDelegate::ResponseListenerInfo::~ResponseListenerInfo() = default;
|
||||||
|
|
||||||
AtomNetworkDelegate::AtomNetworkDelegate() {}
|
AtomNetworkDelegate::AtomNetworkDelegate() {}
|
||||||
|
|
||||||
AtomNetworkDelegate::~AtomNetworkDelegate() {}
|
AtomNetworkDelegate::~AtomNetworkDelegate() {}
|
||||||
|
|
|
@ -51,11 +51,19 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
|
||||||
struct SimpleListenerInfo {
|
struct SimpleListenerInfo {
|
||||||
URLPatterns url_patterns;
|
URLPatterns url_patterns;
|
||||||
SimpleListener listener;
|
SimpleListener listener;
|
||||||
|
|
||||||
|
SimpleListenerInfo(URLPatterns, SimpleListener);
|
||||||
|
SimpleListenerInfo();
|
||||||
|
~SimpleListenerInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ResponseListenerInfo {
|
struct ResponseListenerInfo {
|
||||||
URLPatterns url_patterns;
|
URLPatterns url_patterns;
|
||||||
ResponseListener listener;
|
ResponseListener listener;
|
||||||
|
|
||||||
|
ResponseListenerInfo(URLPatterns, ResponseListener);
|
||||||
|
ResponseListenerInfo();
|
||||||
|
~ResponseListenerInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
AtomNetworkDelegate();
|
AtomNetworkDelegate();
|
||||||
|
|
|
@ -105,7 +105,7 @@ void AtomURLRequest::DoInitialize(
|
||||||
redirect_policy_ = redirect_policy;
|
redirect_policy_ = redirect_policy;
|
||||||
request_context_getter_ = request_context_getter;
|
request_context_getter_ = request_context_getter;
|
||||||
request_context_getter_->AddObserver(this);
|
request_context_getter_->AddObserver(this);
|
||||||
auto context = request_context_getter_->GetURLRequestContext();
|
auto* context = request_context_getter_->GetURLRequestContext();
|
||||||
if (!context) {
|
if (!context) {
|
||||||
// Called after shutdown.
|
// Called after shutdown.
|
||||||
DoCancelWithError("Cannot start a request after shutdown.", true);
|
DoCancelWithError("Cannot start a request after shutdown.", true);
|
||||||
|
@ -238,14 +238,14 @@ void AtomURLRequest::DoWriteBuffer(
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
// Handling potential empty buffers.
|
// Handling potential empty buffers.
|
||||||
using internal::UploadOwnedIOBufferElementReader;
|
using internal::UploadOwnedIOBufferElementReader;
|
||||||
auto element_reader =
|
auto* element_reader =
|
||||||
UploadOwnedIOBufferElementReader::CreateWithBuffer(std::move(buffer));
|
UploadOwnedIOBufferElementReader::CreateWithBuffer(std::move(buffer));
|
||||||
upload_element_readers_.push_back(
|
upload_element_readers_.push_back(
|
||||||
std::unique_ptr<net::UploadElementReader>(element_reader));
|
std::unique_ptr<net::UploadElementReader>(element_reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_last) {
|
if (is_last) {
|
||||||
auto elements_upload_data_stream = new net::ElementsUploadDataStream(
|
auto* elements_upload_data_stream = new net::ElementsUploadDataStream(
|
||||||
std::move(upload_element_readers_), 0);
|
std::move(upload_element_readers_), 0);
|
||||||
request_->set_upload(
|
request_->set_upload(
|
||||||
std::unique_ptr<net::UploadDataStream>(elements_upload_data_stream));
|
std::unique_ptr<net::UploadDataStream>(elements_upload_data_stream));
|
||||||
|
|
|
@ -21,7 +21,7 @@ const void* DisableProtocolInterceptFlagKey();
|
||||||
class AtomURLRequestJobFactory : public net::URLRequestJobFactory {
|
class AtomURLRequestJobFactory : public net::URLRequestJobFactory {
|
||||||
public:
|
public:
|
||||||
AtomURLRequestJobFactory();
|
AtomURLRequestJobFactory();
|
||||||
virtual ~AtomURLRequestJobFactory();
|
~AtomURLRequestJobFactory() override;
|
||||||
|
|
||||||
// Sets the ProtocolHandler for a scheme. Returns true on success, false on
|
// Sets the ProtocolHandler for a scheme. Returns true on success, false on
|
||||||
// failure (a ProtocolHandler already exists for |scheme|). On success,
|
// failure (a ProtocolHandler already exists for |scheme|). On success,
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace atom {
|
||||||
class HttpProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
|
class HttpProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
|
||||||
public:
|
public:
|
||||||
explicit HttpProtocolHandler(const std::string&);
|
explicit HttpProtocolHandler(const std::string&);
|
||||||
virtual ~HttpProtocolHandler();
|
~HttpProtocolHandler() override;
|
||||||
|
|
||||||
// net::URLRequestJobFactory::ProtocolHandler:
|
// net::URLRequestJobFactory::ProtocolHandler:
|
||||||
net::URLRequestJob* MaybeCreateJob(
|
net::URLRequestJob* MaybeCreateJob(
|
||||||
|
|
|
@ -31,6 +31,8 @@ URLRequestBufferJob::URLRequestBufferJob(net::URLRequest* request,
|
||||||
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate),
|
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate),
|
||||||
status_code_(net::HTTP_NOT_IMPLEMENTED) {}
|
status_code_(net::HTTP_NOT_IMPLEMENTED) {}
|
||||||
|
|
||||||
|
URLRequestBufferJob::~URLRequestBufferJob() = default;
|
||||||
|
|
||||||
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
|
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
|
||||||
const base::Value* binary = nullptr;
|
const base::Value* binary = nullptr;
|
||||||
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace atom {
|
||||||
class URLRequestBufferJob : public JsAsker<net::URLRequestSimpleJob> {
|
class URLRequestBufferJob : public JsAsker<net::URLRequestSimpleJob> {
|
||||||
public:
|
public:
|
||||||
URLRequestBufferJob(net::URLRequest*, net::NetworkDelegate*);
|
URLRequestBufferJob(net::URLRequest*, net::NetworkDelegate*);
|
||||||
|
~URLRequestBufferJob() override;
|
||||||
|
|
||||||
// JsAsker:
|
// JsAsker:
|
||||||
void StartAsync(std::unique_ptr<base::Value> options) override;
|
void StartAsync(std::unique_ptr<base::Value> options) override;
|
||||||
|
|
|
@ -83,6 +83,8 @@ URLRequestFetchJob::URLRequestFetchJob(net::URLRequest* request,
|
||||||
pending_buffer_size_(0),
|
pending_buffer_size_(0),
|
||||||
write_num_bytes_(0) {}
|
write_num_bytes_(0) {}
|
||||||
|
|
||||||
|
URLRequestFetchJob::~URLRequestFetchJob() = default;
|
||||||
|
|
||||||
void URLRequestFetchJob::BeforeStartInUI(v8::Isolate* isolate,
|
void URLRequestFetchJob::BeforeStartInUI(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> value) {
|
v8::Local<v8::Value> value) {
|
||||||
mate::Dictionary options;
|
mate::Dictionary options;
|
||||||
|
|
|
@ -20,6 +20,7 @@ class URLRequestFetchJob : public JsAsker<net::URLRequestJob>,
|
||||||
public brightray::URLRequestContextGetter::Delegate {
|
public brightray::URLRequestContextGetter::Delegate {
|
||||||
public:
|
public:
|
||||||
URLRequestFetchJob(net::URLRequest*, net::NetworkDelegate*);
|
URLRequestFetchJob(net::URLRequest*, net::NetworkDelegate*);
|
||||||
|
~URLRequestFetchJob() override;
|
||||||
|
|
||||||
// Called by response writer.
|
// Called by response writer.
|
||||||
void HeadersCompleted();
|
void HeadersCompleted();
|
||||||
|
|
|
@ -28,6 +28,8 @@ URLRequestStreamJob::URLRequestStreamJob(net::URLRequest* request,
|
||||||
response_headers_(nullptr),
|
response_headers_(nullptr),
|
||||||
weak_factory_(this) {}
|
weak_factory_(this) {}
|
||||||
|
|
||||||
|
URLRequestStreamJob::~URLRequestStreamJob() = default;
|
||||||
|
|
||||||
void URLRequestStreamJob::BeforeStartInUI(v8::Isolate* isolate,
|
void URLRequestStreamJob::BeforeStartInUI(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> value) {
|
v8::Local<v8::Value> value) {
|
||||||
if (value->IsNull() || value->IsUndefined() || !value->IsObject()) {
|
if (value->IsNull() || value->IsUndefined() || !value->IsObject()) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ class URLRequestStreamJob : public JsAsker<net::URLRequestJob> {
|
||||||
public:
|
public:
|
||||||
URLRequestStreamJob(net::URLRequest* request,
|
URLRequestStreamJob(net::URLRequest* request,
|
||||||
net::NetworkDelegate* network_delegate);
|
net::NetworkDelegate* network_delegate);
|
||||||
|
~URLRequestStreamJob() override;
|
||||||
|
|
||||||
void OnData(mate::Arguments* args);
|
void OnData(mate::Arguments* args);
|
||||||
void OnEnd(mate::Arguments* args);
|
void OnEnd(mate::Arguments* args);
|
||||||
|
|
|
@ -15,6 +15,8 @@ URLRequestStringJob::URLRequestStringJob(net::URLRequest* request,
|
||||||
net::NetworkDelegate* network_delegate)
|
net::NetworkDelegate* network_delegate)
|
||||||
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate) {}
|
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate) {}
|
||||||
|
|
||||||
|
URLRequestStringJob::~URLRequestStringJob() = default;
|
||||||
|
|
||||||
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
|
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
|
||||||
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
||||||
base::DictionaryValue* dict =
|
base::DictionaryValue* dict =
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace atom {
|
||||||
class URLRequestStringJob : public JsAsker<net::URLRequestSimpleJob> {
|
class URLRequestStringJob : public JsAsker<net::URLRequestSimpleJob> {
|
||||||
public:
|
public:
|
||||||
URLRequestStringJob(net::URLRequest*, net::NetworkDelegate*);
|
URLRequestStringJob(net::URLRequest*, net::NetworkDelegate*);
|
||||||
|
~URLRequestStringJob() override;
|
||||||
|
|
||||||
// JsAsker:
|
// JsAsker:
|
||||||
void StartAsync(std::unique_ptr<base::Value> options) override;
|
void StartAsync(std::unique_ptr<base::Value> options) override;
|
||||||
|
|
|
@ -18,7 +18,7 @@ NodeDebugger::NodeDebugger(node::Environment* env) : env_(env) {}
|
||||||
NodeDebugger::~NodeDebugger() {}
|
NodeDebugger::~NodeDebugger() {}
|
||||||
|
|
||||||
void NodeDebugger::Start(node::MultiIsolatePlatform* platform) {
|
void NodeDebugger::Start(node::MultiIsolatePlatform* platform) {
|
||||||
auto inspector = env_->inspector_agent();
|
auto* inspector = env_->inspector_agent();
|
||||||
if (inspector == nullptr)
|
if (inspector == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class RenderProcessPreferences : public content::NotificationObserver {
|
||||||
// The |predicate| is used to determine whether to set preferences for a
|
// The |predicate| is used to determine whether to set preferences for a
|
||||||
// render process.
|
// render process.
|
||||||
explicit RenderProcessPreferences(const Predicate& predicate);
|
explicit RenderProcessPreferences(const Predicate& predicate);
|
||||||
virtual ~RenderProcessPreferences();
|
~RenderProcessPreferences() override;
|
||||||
|
|
||||||
int AddEntry(const base::DictionaryValue& entry);
|
int AddEntry(const base::DictionaryValue& entry);
|
||||||
void RemoveEntry(int id);
|
void RemoveEntry(int id);
|
||||||
|
|
|
@ -74,7 +74,7 @@ void GenerateAcceleratorTable(AcceleratorTable* table,
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
atom::AtomMenuModel::ItemType type = model->GetTypeAt(i);
|
atom::AtomMenuModel::ItemType type = model->GetTypeAt(i);
|
||||||
if (type == atom::AtomMenuModel::TYPE_SUBMENU) {
|
if (type == atom::AtomMenuModel::TYPE_SUBMENU) {
|
||||||
auto submodel = model->GetSubmenuModelAt(i);
|
auto* submodel = model->GetSubmenuModelAt(i);
|
||||||
GenerateAcceleratorTable(table, submodel);
|
GenerateAcceleratorTable(table, submodel);
|
||||||
} else {
|
} else {
|
||||||
ui::Accelerator accelerator;
|
ui::Accelerator accelerator;
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
bool AtomMenuModel::Delegate::GetAcceleratorForCommandId(int command_id,
|
||||||
|
ui::Accelerator* accelerator) const {
|
||||||
|
return GetAcceleratorForCommandIdWithParams(
|
||||||
|
command_id, false, accelerator);
|
||||||
|
}
|
||||||
|
|
||||||
AtomMenuModel::AtomMenuModel(Delegate* delegate)
|
AtomMenuModel::AtomMenuModel(Delegate* delegate)
|
||||||
: ui::SimpleMenuModel(delegate), delegate_(delegate) {}
|
: ui::SimpleMenuModel(delegate), delegate_(delegate) {}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||||
public:
|
public:
|
||||||
class Delegate : public ui::SimpleMenuModel::Delegate {
|
class Delegate : public ui::SimpleMenuModel::Delegate {
|
||||||
public:
|
public:
|
||||||
virtual ~Delegate() {}
|
~Delegate() override {}
|
||||||
|
|
||||||
virtual bool GetAcceleratorForCommandIdWithParams(
|
virtual bool GetAcceleratorForCommandIdWithParams(
|
||||||
int command_id,
|
int command_id,
|
||||||
|
@ -25,11 +25,9 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ui::SimpleMenuModel::Delegate:
|
// ui::SimpleMenuModel::Delegate:
|
||||||
bool GetAcceleratorForCommandId(int command_id,
|
bool GetAcceleratorForCommandId(
|
||||||
ui::Accelerator* accelerator) const {
|
int command_id,
|
||||||
return GetAcceleratorForCommandIdWithParams(command_id, false,
|
ui::Accelerator* accelerator) const override;
|
||||||
accelerator);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Observer {
|
class Observer {
|
||||||
|
@ -44,7 +42,7 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AtomMenuModel(Delegate* delegate);
|
explicit AtomMenuModel(Delegate* delegate);
|
||||||
virtual ~AtomMenuModel();
|
~AtomMenuModel() override;
|
||||||
|
|
||||||
void AddObserver(Observer* obs) { observers_.AddObserver(obs); }
|
void AddObserver(Observer* obs) { observers_.AddObserver(obs); }
|
||||||
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
|
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
|
||||||
|
|
|
@ -21,7 +21,7 @@ class AutofillPopupView;
|
||||||
class AutofillPopup : public views::ViewObserver {
|
class AutofillPopup : public views::ViewObserver {
|
||||||
public:
|
public:
|
||||||
AutofillPopup();
|
AutofillPopup();
|
||||||
~AutofillPopup();
|
~AutofillPopup() override;
|
||||||
|
|
||||||
void CreateView(content::RenderFrameHost* render_frame,
|
void CreateView(content::RenderFrameHost* render_frame,
|
||||||
bool offscreen,
|
bool offscreen,
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
- (void)panelDidEnd:(NSWindow*)sheet
|
- (void)panelDidEnd:(NSWindow*)sheet
|
||||||
returnCode:(int)returnCode
|
returnCode:(int)returnCode
|
||||||
contextInfo:(void*)contextInfo {
|
contextInfo:(void*)contextInfo {
|
||||||
auto cert_db = net::CertDatabase::GetInstance();
|
auto* cert_db = net::CertDatabase::GetInstance();
|
||||||
// This forces Chromium to reload the certificate since it might be trusted
|
// This forces Chromium to reload the certificate since it might be trusted
|
||||||
// now.
|
// now.
|
||||||
cert_db->NotifyObserversCertDBChanged();
|
cert_db->NotifyObserversCertDBChanged();
|
||||||
|
@ -86,7 +86,7 @@ void ShowCertificateTrust(atom::NativeWindow* parent_window,
|
||||||
const scoped_refptr<net::X509Certificate>& cert,
|
const scoped_refptr<net::X509Certificate>& cert,
|
||||||
const std::string& message,
|
const std::string& message,
|
||||||
const ShowTrustCallback& callback) {
|
const ShowTrustCallback& callback) {
|
||||||
auto sec_policy = SecPolicyCreateBasicX509();
|
auto* sec_policy = SecPolicyCreateBasicX509();
|
||||||
auto cert_chain =
|
auto cert_chain =
|
||||||
net::x509_util::CreateSecCertificateArrayForX509Certificate(cert.get());
|
net::x509_util::CreateSecCertificateArrayForX509Certificate(cert.get());
|
||||||
SecTrustRef trust = nullptr;
|
SecTrustRef trust = nullptr;
|
||||||
|
|
|
@ -31,16 +31,19 @@
|
||||||
window:(atom::NativeWindow*)window
|
window:(atom::NativeWindow*)window
|
||||||
settings:(const std::vector<mate::PersistentDictionary>&)settings;
|
settings:(const std::vector<mate::PersistentDictionary>&)settings;
|
||||||
|
|
||||||
- (NSTouchBar*)makeTouchBar;
|
- (NSTouchBar*)makeTouchBar API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBar*)touchBarFromItemIdentifiers:(NSMutableArray*)items;
|
- (NSTouchBar*)touchBarFromItemIdentifiers:(NSMutableArray*)items
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSMutableArray*)identifiersFromSettings:
|
- (NSMutableArray*)identifiersFromSettings:
|
||||||
(const std::vector<mate::PersistentDictionary>&)settings;
|
(const std::vector<mate::PersistentDictionary>&)settings;
|
||||||
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar
|
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar
|
||||||
id:(const std::string&)item_id;
|
id:(const std::string&)item_id
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (void)addNonDefaultTouchBarItems:
|
- (void)addNonDefaultTouchBarItems:
|
||||||
(const std::vector<mate::PersistentDictionary>&)items;
|
(const std::vector<mate::PersistentDictionary>&)items;
|
||||||
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item
|
- (void)setEscapeTouchBarItem:(const mate::PersistentDictionary&)item
|
||||||
forTouchBar:(NSTouchBar*)touchBar;
|
forTouchBar:(NSTouchBar*)touchBar
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
|
|
||||||
- (NSString*)idFromIdentifier:(NSString*)identifier
|
- (NSString*)idFromIdentifier:(NSString*)identifier
|
||||||
withPrefix:(NSString*)prefix;
|
withPrefix:(NSString*)prefix;
|
||||||
|
@ -51,35 +54,47 @@
|
||||||
|
|
||||||
// Selector actions
|
// Selector actions
|
||||||
- (void)buttonAction:(id)sender;
|
- (void)buttonAction:(id)sender;
|
||||||
- (void)colorPickerAction:(id)sender;
|
- (void)colorPickerAction:(id)sender API_AVAILABLE(macosx(10.12.2));
|
||||||
- (void)sliderAction:(id)sender;
|
- (void)sliderAction:(id)sender API_AVAILABLE(macosx(10.12.2));
|
||||||
|
|
||||||
// Helpers to create touch bar items
|
// Helpers to create touch bar items
|
||||||
- (NSTouchBarItem*)makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
|
- (NSTouchBarItem*)makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBarItem*)makeButtonForID:(NSString*)id
|
- (NSTouchBarItem*)makeButtonForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier;
|
withIdentifier:(NSString*)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBarItem*)makeLabelForID:(NSString*)id
|
- (NSTouchBarItem*)makeLabelForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier;
|
withIdentifier:(NSString*)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBarItem*)makeColorPickerForID:(NSString*)id
|
- (NSTouchBarItem*)makeColorPickerForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier;
|
withIdentifier:(NSString*)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBarItem*)makeSliderForID:(NSString*)id
|
- (NSTouchBarItem*)makeSliderForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier;
|
withIdentifier:(NSString*)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBarItem*)makePopoverForID:(NSString*)id
|
- (NSTouchBarItem*)makePopoverForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier;
|
withIdentifier:(NSString*)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (NSTouchBarItem*)makeGroupForID:(NSString*)id
|
- (NSTouchBarItem*)makeGroupForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier;
|
withIdentifier:(NSString*)identifier
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
|
|
||||||
// Helpers to update touch bar items
|
// Helpers to update touch bar items
|
||||||
- (void)updateButton:(NSCustomTouchBarItem*)item
|
- (void)updateButton:(NSCustomTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings;
|
withSettings:(const mate::PersistentDictionary&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (void)updateLabel:(NSCustomTouchBarItem*)item
|
- (void)updateLabel:(NSCustomTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings;
|
withSettings:(const mate::PersistentDictionary&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (void)updateColorPicker:(NSColorPickerTouchBarItem*)item
|
- (void)updateColorPicker:(NSColorPickerTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings;
|
withSettings:(const mate::PersistentDictionary&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (void)updateSlider:(NSSliderTouchBarItem*)item
|
- (void)updateSlider:(NSSliderTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings;
|
withSettings:(const mate::PersistentDictionary&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
- (void)updatePopover:(NSPopoverTouchBarItem*)item
|
- (void)updatePopover:(NSPopoverTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings;
|
withSettings:(const mate::PersistentDictionary&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2));
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -51,32 +51,34 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
- (NSMutableArray*)identifiersFromSettings:(const std::vector<mate::PersistentDictionary>&)dicts {
|
- (NSMutableArray*)identifiersFromSettings:(const std::vector<mate::PersistentDictionary>&)dicts {
|
||||||
NSMutableArray* identifiers = [NSMutableArray array];
|
NSMutableArray* identifiers = [NSMutableArray array];
|
||||||
|
|
||||||
for (const auto& item : dicts) {
|
if (@available(macOS 10.12.2, *)) {
|
||||||
std::string type;
|
for (const auto& item : dicts) {
|
||||||
std::string item_id;
|
std::string type;
|
||||||
if (item.Get("type", &type) && item.Get("id", &item_id)) {
|
std::string item_id;
|
||||||
NSTouchBarItemIdentifier identifier = nil;
|
if (item.Get("type", &type) && item.Get("id", &item_id)) {
|
||||||
if (type == "spacer") {
|
NSTouchBarItemIdentifier identifier = nil;
|
||||||
std::string size;
|
if (type == "spacer") {
|
||||||
item.Get("size", &size);
|
std::string size;
|
||||||
if (size == "large") {
|
item.Get("size", &size);
|
||||||
identifier = NSTouchBarItemIdentifierFixedSpaceLarge;
|
if (size == "large") {
|
||||||
} else if (size == "flexible") {
|
identifier = NSTouchBarItemIdentifierFixedSpaceLarge;
|
||||||
identifier = NSTouchBarItemIdentifierFlexibleSpace;
|
} else if (size == "flexible") {
|
||||||
|
identifier = NSTouchBarItemIdentifierFlexibleSpace;
|
||||||
|
} else {
|
||||||
|
identifier = NSTouchBarItemIdentifierFixedSpaceSmall;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
identifier = NSTouchBarItemIdentifierFixedSpaceSmall;
|
identifier = [self identifierFromID:item_id type:type];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
identifier = [self identifierFromID:item_id type:type];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
settings_[item_id] = item;
|
settings_[item_id] = item;
|
||||||
[identifiers addObject:identifier];
|
[identifiers addObject:identifier];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[identifiers addObject:NSTouchBarItemIdentifierOtherItemsProxy];
|
||||||
}
|
}
|
||||||
[identifiers addObject:NSTouchBarItemIdentifierOtherItemsProxy];
|
|
||||||
|
|
||||||
return identifiers;
|
return identifiers;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,8 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar
|
- (void)refreshTouchBarItem:(NSTouchBar*)touchBar
|
||||||
id:(NSTouchBarItemIdentifier)identifier
|
id:(NSTouchBarItemIdentifier)identifier
|
||||||
withType:(const std::string&)item_type
|
withType:(const std::string&)item_type
|
||||||
withSettings:(const mate::PersistentDictionary&)settings {
|
withSettings:(const mate::PersistentDictionary&)settings
|
||||||
|
API_AVAILABLE(macosx(10.12.2)) {
|
||||||
NSTouchBarItem* item = [touchBar itemForIdentifier:identifier];
|
NSTouchBarItem* item = [touchBar itemForIdentifier:identifier];
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
|
@ -245,14 +248,14 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
details);
|
details);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scrubber:(NSScrubber*)scrubber didSelectItemAtIndex:(NSInteger)selectedIndex {
|
- (void)scrubber:(NSScrubber*)scrubber didSelectItemAtIndex:(NSInteger)selectedIndex API_AVAILABLE(macosx(10.12.2)) {
|
||||||
base::DictionaryValue details;
|
base::DictionaryValue details;
|
||||||
details.SetInteger("selectedIndex", selectedIndex);
|
details.SetInteger("selectedIndex", selectedIndex);
|
||||||
details.SetString("type", "select");
|
details.SetString("type", "select");
|
||||||
window_->NotifyTouchBarItemInteraction([scrubber.identifier UTF8String], details);
|
window_->NotifyTouchBarItemInteraction([scrubber.identifier UTF8String], details);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scrubber:(NSScrubber*)scrubber didHighlightItemAtIndex:(NSInteger)highlightedIndex {
|
- (void)scrubber:(NSScrubber*)scrubber didHighlightItemAtIndex:(NSInteger)highlightedIndex API_AVAILABLE(macosx(10.12.2)) {
|
||||||
base::DictionaryValue details;
|
base::DictionaryValue details;
|
||||||
details.SetInteger("highlightedIndex", highlightedIndex);
|
details.SetInteger("highlightedIndex", highlightedIndex);
|
||||||
details.SetString("type", "highlight");
|
details.SetString("type", "highlight");
|
||||||
|
@ -494,7 +497,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateGroup:(NSGroupTouchBarItem*)item
|
- (void)updateGroup:(NSGroupTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings {
|
withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)) {
|
||||||
|
|
||||||
mate::PersistentDictionary child;
|
mate::PersistentDictionary child;
|
||||||
if (!settings.Get("child", &child)) return;
|
if (!settings.Get("child", &child)) return;
|
||||||
|
@ -505,7 +508,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTouchBarItem*)makeSegmentedControlForID:(NSString*)id
|
- (NSTouchBarItem*)makeSegmentedControlForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier {
|
withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)) {
|
||||||
std::string s_id([id UTF8String]);
|
std::string s_id([id UTF8String]);
|
||||||
if (![self hasItemWithID:s_id]) return nil;
|
if (![self hasItemWithID:s_id]) return nil;
|
||||||
|
|
||||||
|
@ -525,7 +528,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateSegmentedControl:(NSCustomTouchBarItem*)item
|
- (void)updateSegmentedControl:(NSCustomTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings {
|
withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)) {
|
||||||
|
|
||||||
NSSegmentedControl* control = item.view;
|
NSSegmentedControl* control = item.view;
|
||||||
|
|
||||||
|
@ -582,7 +585,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTouchBarItem*)makeScrubberForID:(NSString*)id
|
- (NSTouchBarItem*)makeScrubberForID:(NSString*)id
|
||||||
withIdentifier:(NSString*)identifier {
|
withIdentifier:(NSString*)identifier API_AVAILABLE(macosx(10.12.2)) {
|
||||||
std::string s_id([id UTF8String]);
|
std::string s_id([id UTF8String]);
|
||||||
if (![self hasItemWithID:s_id]) return nil;
|
if (![self hasItemWithID:s_id]) return nil;
|
||||||
|
|
||||||
|
@ -606,7 +609,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateScrubber:(NSCustomTouchBarItem*)item
|
- (void)updateScrubber:(NSCustomTouchBarItem*)item
|
||||||
withSettings:(const mate::PersistentDictionary&)settings {
|
withSettings:(const mate::PersistentDictionary&)settings API_AVAILABLE(macosx(10.12.2)) {
|
||||||
NSScrubber* scrubber = item.view;
|
NSScrubber* scrubber = item.view;
|
||||||
|
|
||||||
bool showsArrowButtons = false;
|
bool showsArrowButtons = false;
|
||||||
|
@ -649,7 +652,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
[scrubber reloadData];
|
[scrubber reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)numberOfItemsForScrubber:(NSScrubber*)scrubber {
|
- (NSInteger)numberOfItemsForScrubber:(NSScrubber*)scrubber API_AVAILABLE(macosx(10.12.2)) {
|
||||||
std::string s_id([[scrubber identifier] UTF8String]);
|
std::string s_id([[scrubber identifier] UTF8String]);
|
||||||
if (![self hasItemWithID:s_id]) return 0;
|
if (![self hasItemWithID:s_id]) return 0;
|
||||||
|
|
||||||
|
@ -660,7 +663,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSScrubberItemView*)scrubber:(NSScrubber*)scrubber
|
- (NSScrubberItemView*)scrubber:(NSScrubber*)scrubber
|
||||||
viewForItemAtIndex:(NSInteger)index {
|
viewForItemAtIndex:(NSInteger)index API_AVAILABLE(macosx(10.12.2)) {
|
||||||
std::string s_id([[scrubber identifier] UTF8String]);
|
std::string s_id([[scrubber identifier] UTF8String]);
|
||||||
if (![self hasItemWithID:s_id]) return nil;
|
if (![self hasItemWithID:s_id]) return nil;
|
||||||
|
|
||||||
|
@ -694,7 +697,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSSize)scrubber:(NSScrubber *)scrubber layout:(NSScrubberFlowLayout *)layout sizeForItemAtIndex:(NSInteger)itemIndex
|
- (NSSize)scrubber:(NSScrubber *)scrubber layout:(NSScrubberFlowLayout *)layout sizeForItemAtIndex:(NSInteger)itemIndex
|
||||||
{
|
API_AVAILABLE(macosx(10.12.2)) {
|
||||||
NSInteger width = 50;
|
NSInteger width = 50;
|
||||||
NSInteger height = 30;
|
NSInteger height = 30;
|
||||||
NSInteger margin = 15;
|
NSInteger margin = 15;
|
||||||
|
|
|
@ -259,7 +259,7 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
|
||||||
@class NSTouchBarItem;
|
@class NSTouchBarItem;
|
||||||
|
|
||||||
@interface NSWindow (TouchBarSDK)
|
@interface NSWindow (TouchBarSDK)
|
||||||
@property(strong, readonly) NSTouchBar* touchBar;
|
@property(strong, readonly) NSTouchBar* touchBar API_AVAILABLE(macosx(10.12.2));
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // MAC_OS_X_VERSION_10_12_1
|
#endif // MAC_OS_X_VERSION_10_12_1
|
||||||
|
|
|
@ -64,6 +64,9 @@ struct DialogSettings {
|
||||||
bool shows_tag_field = true;
|
bool shows_tag_field = true;
|
||||||
bool force_detached = false;
|
bool force_detached = false;
|
||||||
bool security_scoped_bookmarks = false;
|
bool security_scoped_bookmarks = false;
|
||||||
|
|
||||||
|
DialogSettings();
|
||||||
|
~DialogSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ShowOpenDialog(const DialogSettings& settings,
|
bool ShowOpenDialog(const DialogSettings& settings,
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
namespace file_dialog {
|
namespace file_dialog {
|
||||||
|
|
||||||
|
DialogSettings::DialogSettings() = default;
|
||||||
|
DialogSettings::~DialogSettings() = default;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Makes sure that .jpg also shows .JPG.
|
// Makes sure that .jpg also shows .JPG.
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
@implementation PopUpButtonHandler
|
@implementation PopUpButtonHandler
|
||||||
|
|
||||||
|
@synthesize savePanel;
|
||||||
|
@synthesize fileTypesList;
|
||||||
|
|
||||||
- (instancetype)initWithPanel:(NSSavePanel*)panel
|
- (instancetype)initWithPanel:(NSSavePanel*)panel
|
||||||
andTypesList:(NSArray*)typesList {
|
andTypesList:(NSArray*)typesList {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
@ -69,6 +72,9 @@
|
||||||
|
|
||||||
namespace file_dialog {
|
namespace file_dialog {
|
||||||
|
|
||||||
|
DialogSettings::DialogSettings() = default;
|
||||||
|
DialogSettings::~DialogSettings() = default;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
|
void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
namespace file_dialog {
|
namespace file_dialog {
|
||||||
|
|
||||||
|
DialogSettings::DialogSettings() = default;
|
||||||
|
DialogSettings::~DialogSettings() = default;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Distinguish directories from regular files.
|
// Distinguish directories from regular files.
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace atom {
|
||||||
class TrayIconCocoa : public TrayIcon, public AtomMenuModel::Observer {
|
class TrayIconCocoa : public TrayIcon, public AtomMenuModel::Observer {
|
||||||
public:
|
public:
|
||||||
TrayIconCocoa();
|
TrayIconCocoa();
|
||||||
virtual ~TrayIconCocoa();
|
~TrayIconCocoa() override;
|
||||||
|
|
||||||
void SetImage(const gfx::Image& image) override;
|
void SetImage(const gfx::Image& image) override;
|
||||||
void SetPressedImage(const gfx::Image& image) override;
|
void SetPressedImage(const gfx::Image& image) override;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue