Fix code styling problems
This commit is contained in:
parent
3f2a25d07c
commit
7268f434b2
9 changed files with 51 additions and 36 deletions
|
@ -250,11 +250,14 @@ void App::OnFinishLaunching() {
|
|||
Emit("ready");
|
||||
}
|
||||
|
||||
void App::OnContinueUserActivity(bool* prevent_default,
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) {
|
||||
#if defined(OS_MACOSX)
|
||||
void App::OnContinueUserActivity(
|
||||
bool* prevent_default,
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) {
|
||||
*prevent_default = Emit("continue-activity", type, user_info);
|
||||
}
|
||||
#endif
|
||||
|
||||
void App::OnLogin(LoginHandler* login_handler) {
|
||||
v8::Locker locker(isolate());
|
||||
|
|
|
@ -72,9 +72,12 @@ class App : public AtomBrowserClient::Delegate,
|
|||
void OnWillFinishLaunching() override;
|
||||
void OnFinishLaunching() override;
|
||||
void OnLogin(LoginHandler* login_handler) override;
|
||||
void OnContinueUserActivity(bool* prevent_default,
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) override;
|
||||
#if defined(OS_MACOSX)
|
||||
void OnContinueUserActivity(
|
||||
bool* prevent_default,
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) override;
|
||||
#endif
|
||||
|
||||
// content::ContentBrowserClient:
|
||||
void AllowCertificateError(
|
||||
|
|
|
@ -138,9 +138,9 @@ void Browser::Activate(bool has_visible_windows) {
|
|||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool Browser::ContinueUserActivity(const std::string& type,
|
||||
const std::map<std::string,
|
||||
std::string>& user_info) {
|
||||
bool Browser::ContinueUserActivity(
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) {
|
||||
bool prevent_default = false;
|
||||
FOR_EACH_OBSERVER(BrowserObserver,
|
||||
observers_,
|
||||
|
|
|
@ -101,8 +101,9 @@ class Browser : public WindowListObserver {
|
|||
std::string GetCurrentActivityType();
|
||||
|
||||
// Resumes an activity via hand-off.
|
||||
bool ContinueUserActivity(const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info);
|
||||
bool ContinueUserActivity(
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info);
|
||||
|
||||
// Bounce the dock icon.
|
||||
enum BounceType {
|
||||
|
|
|
@ -87,17 +87,20 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol) {
|
|||
void Browser::SetAppUserModelID(const base::string16& name) {
|
||||
}
|
||||
|
||||
void Browser::SetUserActivity(const std::string& type, const std::map<std::string, std::string>& user_info) {
|
||||
void Browser::SetUserActivity(
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) {
|
||||
NSString* type_ns = [NSString stringWithUTF8String:type.c_str()];
|
||||
NSUserActivity* user_activity = [[NSUserActivity alloc] initWithActivityType:type_ns];
|
||||
NSUserActivity* user_activity =
|
||||
[[NSUserActivity alloc] initWithActivityType:type_ns];
|
||||
|
||||
base::scoped_nsobject<NSMutableDictionary> user_info_args([[NSMutableDictionary alloc] init]);
|
||||
base::scoped_nsobject<NSMutableDictionary> user_info_args(
|
||||
[[NSMutableDictionary alloc] init]);
|
||||
for (auto const &pair : user_info) {
|
||||
NSString* value_ns = [NSString stringWithUTF8String:pair.second.c_str()];
|
||||
NSString* key_ns = [NSString stringWithUTF8String:pair.first.c_str()];
|
||||
|
||||
[user_info_args.get() setObject:value_ns
|
||||
forKey:key_ns];
|
||||
[user_info_args.get() setObject:value_ns forKey:key_ns];
|
||||
}
|
||||
|
||||
user_activity.userInfo = user_info_args.get();
|
||||
|
@ -107,7 +110,8 @@ void Browser::SetUserActivity(const std::string& type, const std::map<std::strin
|
|||
}
|
||||
|
||||
std::string Browser::GetCurrentActivityType() {
|
||||
NSUserActivity* user_activity = [[AtomApplication sharedApplication] getCurrentActivity];
|
||||
NSUserActivity* user_activity =
|
||||
[[AtomApplication sharedApplication] getCurrentActivity];
|
||||
return base::SysNSStringToUTF8(user_activity.activityType);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class LoginHandler;
|
||||
|
@ -46,10 +48,13 @@ class BrowserObserver {
|
|||
// The browser requests HTTP login.
|
||||
virtual void OnLogin(LoginHandler* login_handler) {}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// The browser wants to resume a user activity via handoff. (OS X only)
|
||||
virtual void OnContinueUserActivity(bool* prevent_default,
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) {}
|
||||
virtual void OnContinueUserActivity(
|
||||
bool* prevent_default,
|
||||
const std::string& type,
|
||||
const std::map<std::string, std::string>& user_info) {}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual ~BrowserObserver() {}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
||||
|
||||
- (NSUserActivity*)getCurrentActivity;
|
||||
|
||||
- (void)setCurrentActivity:(NSUserActivity*)userActivity;
|
||||
|
||||
@end
|
||||
|
|
|
@ -59,9 +59,9 @@
|
|||
return flag;
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)sender
|
||||
continueUserActivity:(NSUserActivity *)userActivity
|
||||
restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
|
||||
- (BOOL)application:(NSApplication*)sender
|
||||
continueUserActivity:(NSUserActivity*)userActivity
|
||||
restorationHandler:(void (^)(NSArray*restorableObjects))restorationHandler {
|
||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||
|
||||
std::map<std::string, std::string> user_info;
|
||||
|
|
|
@ -118,15 +118,15 @@ Returns:
|
|||
* `event` Event
|
||||
* `type` String - A string identifying the event. Maps to [`NSUserActivity.activityType`](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType).
|
||||
* `userInfo` Object - Contains app-specific state stored by the activity on
|
||||
another device. Currently only string data is supported.
|
||||
another device. Currently only string data is supported.
|
||||
|
||||
Emitted during [handoff](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html) when an activity from a different device wants to be
|
||||
resumed. You should call `event.preventDefault()` if you want to handle this
|
||||
event.
|
||||
Emitted during [handoff][handoff] when an activity from a different device wants
|
||||
to be resumed. You should call `event.preventDefault()` if you want to handle
|
||||
this event.
|
||||
|
||||
A user activity can be continued only in an app that has the same developer
|
||||
Team ID as the activity's source app and that supports the activity's type.
|
||||
Supported activity types are specified in the app's Info.plist under the
|
||||
A user activity can be continued only in an app that has the same developer Team
|
||||
ID as the activity's source app and that supports the activity's type.
|
||||
Supported activity types are specified in the app's `Info.plist` under the
|
||||
`NSUserActivityTypes` key.
|
||||
|
||||
### Event: 'browser-window-blur'
|
||||
|
@ -503,12 +503,12 @@ app.on('ready', function() {
|
|||
### `app.setUserActivity(type, userInfo)` _OS X_
|
||||
|
||||
* `type` String - Uniquely identifies the activity. It's recommended to use a
|
||||
reverse-DNS string.
|
||||
reverse-DNS string.
|
||||
* `userInfo` Object - App-specific state to store for use by another device.
|
||||
Currently only string data is supported.
|
||||
Currently only string data is supported.
|
||||
|
||||
Creates an `NSUserActivity` and sets it as the current activity. The activity
|
||||
is eligible for [handoff](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html) to another device afterward.
|
||||
is eligible for [handoff][handoff] to another device afterward.
|
||||
|
||||
### `app.getCurrentActivityType()` _OS X_
|
||||
|
||||
|
@ -600,5 +600,5 @@ Sets the `image` associated with this dock icon.
|
|||
[tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||
[CFBundleURLTypes]: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115
|
||||
[LSCopyDefaultHandlerForURLScheme]:
|
||||
https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
|
||||
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
|
||||
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
|
||||
|
|
Loading…
Reference in a new issue