2013-05-02 15:43:23 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "browser/browser.h"
|
|
|
|
|
2013-06-19 05:41:54 +00:00
|
|
|
#import "base/mac/bundle_locations.h"
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
2013-05-02 15:43:23 +00:00
|
|
|
#import "browser/atom_application_mac.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
void Browser::Terminate() {
|
2013-06-26 09:22:24 +00:00
|
|
|
is_quiting_ = true;
|
2013-05-02 15:43:23 +00:00
|
|
|
[[AtomApplication sharedApplication] terminate:nil];
|
|
|
|
}
|
|
|
|
|
2013-05-30 11:24:47 +00:00
|
|
|
void Browser::Focus() {
|
2013-06-26 09:22:24 +00:00
|
|
|
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
|
2013-05-30 11:24:47 +00:00
|
|
|
}
|
|
|
|
|
2013-06-19 05:41:54 +00:00
|
|
|
std::string Browser::GetVersion() {
|
|
|
|
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
|
|
|
|
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
|
|
|
|
return base::SysNSStringToUTF8(version);
|
|
|
|
}
|
|
|
|
|
2013-06-26 09:22:24 +00:00
|
|
|
void Browser::CancelQuit() {
|
|
|
|
[[AtomApplication sharedApplication] replyToApplicationShouldTerminate:NO];
|
|
|
|
}
|
|
|
|
|
2013-08-06 08:19:56 +00:00
|
|
|
int Browser::DockBounce(BounceType type) {
|
|
|
|
return [[AtomApplication sharedApplication] requestUserAttention:type];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Browser::DockCancelBounce(int rid) {
|
|
|
|
[[AtomApplication sharedApplication] cancelUserAttentionRequest:rid];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Browser::DockSetBadgeText(const std::string& label) {
|
|
|
|
NSDockTile *tile = [[AtomApplication sharedApplication] dockTile];
|
|
|
|
[tile setBadgeLabel:base::SysUTF8ToNSString(label)];
|
|
|
|
}
|
|
|
|
|
2013-05-02 15:43:23 +00:00
|
|
|
} // namespace atom
|