2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-05-03 02:53:54 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 00:58:59 +00:00
|
|
|
#ifndef ATOM_BROWSER_BROWSER_OBSERVER_H_
|
|
|
|
#define ATOM_BROWSER_BROWSER_OBSERVER_H_
|
2013-05-03 02:53:54 +00:00
|
|
|
|
2013-05-30 08:03:10 +00:00
|
|
|
#include <string>
|
|
|
|
|
2016-05-05 03:26:23 +00:00
|
|
|
#include "build/build_config.h"
|
|
|
|
|
2016-05-05 07:26:44 +00:00
|
|
|
namespace base {
|
|
|
|
class DictionaryValue;
|
|
|
|
}
|
|
|
|
|
2013-05-03 02:53:54 +00:00
|
|
|
namespace atom {
|
|
|
|
|
2015-10-28 11:34:01 +00:00
|
|
|
class LoginHandler;
|
|
|
|
|
2013-05-03 02:53:54 +00:00
|
|
|
class BrowserObserver {
|
|
|
|
public:
|
2015-02-26 03:33:42 +00:00
|
|
|
// The browser is about to close all windows.
|
|
|
|
virtual void OnBeforeQuit(bool* prevent_default) {}
|
2015-02-26 05:57:25 +00:00
|
|
|
|
2013-05-03 02:53:54 +00:00
|
|
|
// The browser has closed all windows and will quit.
|
|
|
|
virtual void OnWillQuit(bool* prevent_default) {}
|
|
|
|
|
|
|
|
// The browser has closed all windows. If the browser is quiting, then this
|
|
|
|
// method will not be called, instead it will call OnWillQuit.
|
|
|
|
virtual void OnWindowAllClosed() {}
|
|
|
|
|
2014-09-25 13:47:54 +00:00
|
|
|
// The browser is quitting.
|
|
|
|
virtual void OnQuit() {}
|
|
|
|
|
2013-05-30 08:03:10 +00:00
|
|
|
// The browser has opened a file by double clicking in Finder or dragging the
|
2016-06-18 13:26:26 +00:00
|
|
|
// file to the Dock icon. (macOS only)
|
2013-05-30 08:03:10 +00:00
|
|
|
virtual void OnOpenFile(bool* prevent_default,
|
|
|
|
const std::string& file_path) {}
|
|
|
|
|
2013-07-10 08:10:38 +00:00
|
|
|
// Browser is used to open a url.
|
|
|
|
virtual void OnOpenURL(const std::string& url) {}
|
|
|
|
|
2015-09-15 01:34:27 +00:00
|
|
|
// The browser is activated with visible/invisible windows (usually by
|
|
|
|
// clicking on the dock icon).
|
2015-09-15 02:05:53 +00:00
|
|
|
virtual void OnActivate(bool has_visible_windows) {}
|
2015-09-14 11:28:13 +00:00
|
|
|
|
2013-05-30 11:12:14 +00:00
|
|
|
// The browser has finished loading.
|
2013-06-03 07:31:46 +00:00
|
|
|
virtual void OnWillFinishLaunching() {}
|
2013-05-30 11:12:14 +00:00
|
|
|
virtual void OnFinishLaunching() {}
|
|
|
|
|
2015-10-28 11:34:01 +00:00
|
|
|
// The browser requests HTTP login.
|
2016-06-08 13:52:21 +00:00
|
|
|
virtual void OnLogin(LoginHandler* login_handler,
|
|
|
|
const base::DictionaryValue& request_details) {}
|
2015-10-28 11:34:01 +00:00
|
|
|
|
2016-07-11 21:04:56 +00:00
|
|
|
// The browser's accessibility state has changed.
|
|
|
|
virtual void OnAccessibilityChanged() {};
|
|
|
|
|
2016-05-05 03:26:23 +00:00
|
|
|
#if defined(OS_MACOSX)
|
2016-06-18 13:26:26 +00:00
|
|
|
// The browser wants to resume a user activity via handoff. (macOS only)
|
2016-05-05 03:26:23 +00:00
|
|
|
virtual void OnContinueUserActivity(
|
|
|
|
bool* prevent_default,
|
|
|
|
const std::string& type,
|
2016-05-05 07:26:44 +00:00
|
|
|
const base::DictionaryValue& user_info) {}
|
2016-05-05 03:26:23 +00:00
|
|
|
#endif
|
2016-04-30 00:36:04 +00:00
|
|
|
|
2013-05-03 02:53:54 +00:00
|
|
|
protected:
|
|
|
|
virtual ~BrowserObserver() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
2014-03-16 00:58:59 +00:00
|
|
|
#endif // ATOM_BROWSER_BROWSER_OBSERVER_H_
|