linux: Implemnt browser methods.
This commit is contained in:
parent
52b5f769f0
commit
a4253e3899
3 changed files with 49 additions and 1 deletions
1
atom.gyp
1
atom.gyp
|
@ -84,6 +84,7 @@
|
||||||
'browser/atom_javascript_dialog_manager.h',
|
'browser/atom_javascript_dialog_manager.h',
|
||||||
'browser/browser.cc',
|
'browser/browser.cc',
|
||||||
'browser/browser.h',
|
'browser/browser.h',
|
||||||
|
'browser/browser_linux.cc',
|
||||||
'browser/browser_mac.mm',
|
'browser/browser_mac.mm',
|
||||||
'browser/browser_win.cc',
|
'browser/browser_win.cc',
|
||||||
'browser/browser_observer.h',
|
'browser/browser_observer.h',
|
||||||
|
|
44
browser/browser_linux.cc
Normal file
44
browser/browser_linux.cc
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "browser/native_window.h"
|
||||||
|
#include "browser/window_list.h"
|
||||||
|
#include "common/atom_version.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
void Browser::Terminate() {
|
||||||
|
is_quiting_ = true;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Browser::Focus() {
|
||||||
|
// Focus on the first visible window.
|
||||||
|
WindowList* list = WindowList::GetInstance();
|
||||||
|
for (WindowList::iterator iter = list->begin(); iter != list->end(); ++iter) {
|
||||||
|
NativeWindow* window = *iter;
|
||||||
|
if (window->IsVisible()) {
|
||||||
|
window->Focus(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Browser::GetExecutableFileVersion() const {
|
||||||
|
return ATOM_VERSION_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Browser::GetExecutableFileProductName() const {
|
||||||
|
return "Atom-Shell";
|
||||||
|
}
|
||||||
|
|
||||||
|
void Browser::CancelQuit() {
|
||||||
|
// No way to cancel quit on Linux.
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
|
@ -19,14 +19,17 @@ class WindowListObserver;
|
||||||
class WindowList {
|
class WindowList {
|
||||||
public:
|
public:
|
||||||
typedef std::vector<NativeWindow*> WindowVector;
|
typedef std::vector<NativeWindow*> WindowVector;
|
||||||
|
typedef WindowVector::iterator iterator;
|
||||||
typedef WindowVector::const_iterator const_iterator;
|
typedef WindowVector::const_iterator const_iterator;
|
||||||
typedef WindowVector::const_reverse_iterator const_reverse_iterator;
|
|
||||||
|
|
||||||
// Windows are added to the list before they have constructed windows,
|
// Windows are added to the list before they have constructed windows,
|
||||||
// so the |window()| member function may return NULL.
|
// so the |window()| member function may return NULL.
|
||||||
const_iterator begin() const { return windows_.begin(); }
|
const_iterator begin() const { return windows_.begin(); }
|
||||||
const_iterator end() const { return windows_.end(); }
|
const_iterator end() const { return windows_.end(); }
|
||||||
|
|
||||||
|
iterator begin() { return windows_.begin(); }
|
||||||
|
iterator end() { return windows_.end(); }
|
||||||
|
|
||||||
bool empty() const { return windows_.empty(); }
|
bool empty() const { return windows_.empty(); }
|
||||||
size_t size() const { return windows_.size(); }
|
size_t size() const { return windows_.size(); }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue