Merge branch 'content_tracing_patch' of https://github.com/deepak1556/atom-shell into deepak1556-content_tracing_patch
This commit is contained in:
commit
996a3c2a35
5 changed files with 27 additions and 3 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/nix/xdg_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "brightray/browser/brightray_paths.h"
|
||||
#include "content/public/browser/client_certificate_delegate.h"
|
||||
|
@ -155,6 +156,17 @@ void PassLoginInformation(scoped_refptr<LoginHandler> login_handler,
|
|||
login_handler->CancelAuth();
|
||||
}
|
||||
|
||||
bool GetUserDownloadsDirectory(base::FilePath* path) {
|
||||
#if defined(OS_LINUX)
|
||||
*path = base::nix::GetXDGUserDirectory("DOWNLOAD", "Downloads");
|
||||
return true;
|
||||
#elif defined(OS_MACOSX)
|
||||
return false;
|
||||
#elif defined(OS_WIN)
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
App::App() {
|
||||
|
@ -272,8 +284,11 @@ base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
|
|||
int key = GetPathConstant(name);
|
||||
if (key >= 0)
|
||||
succeed = PathService::Get(key, &path);
|
||||
if (!succeed)
|
||||
if (!succeed) {
|
||||
if (name == "downloads" && GetUserDownloadsDirectory(&path))
|
||||
return path;
|
||||
args->ThrowError("Failed to get path");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ void NativeWindow::TitleWasSet(content::NavigationEntry* entry,
|
|||
FOR_EACH_OBSERVER(NativeWindowObserver,
|
||||
observers_,
|
||||
OnPageTitleUpdated(&prevent_default, text));
|
||||
if (!prevent_default)
|
||||
if (!prevent_default && !is_closed_)
|
||||
SetTitle(text);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ struct Converter<base::FilePath> {
|
|||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
base::FilePath* out) {
|
||||
if (val->IsNull())
|
||||
return true;
|
||||
|
||||
base::FilePath::StringType path;
|
||||
if (Converter<base::FilePath::StringType>::FromV8(isolate, val, &path)) {
|
||||
*out = base::FilePath(path);
|
||||
|
|
|
@ -241,6 +241,7 @@ You can request the following paths by the name:
|
|||
* `userDesktop` The current user's Desktop directory.
|
||||
* `exe` The current executable file.
|
||||
* `module` The `libchromiumcontent` library.
|
||||
* `downloads` User's download directory.
|
||||
|
||||
### `app.setPath(name, path)`
|
||||
|
||||
|
|
|
@ -8,7 +8,12 @@ generated file to view the result.
|
|||
```javascript
|
||||
const contentTracing = require('electron').contentTracing;
|
||||
|
||||
contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, function() {
|
||||
const options = {
|
||||
categoryFilter: '*',
|
||||
traceOptions: 'record-until-full,enable-sampling'
|
||||
}
|
||||
|
||||
contentTracing.startRecording(options, function() {
|
||||
console.log('Tracing started');
|
||||
|
||||
setTimeout(function() {
|
||||
|
|
Loading…
Reference in a new issue