Wire everything up
This commit is contained in:
		
					parent
					
						
							
								c38f2fcf75
							
						
					
				
			
			
				commit
				
					
						cdd51fa96d
					
				
			
		
					 4 changed files with 20 additions and 8 deletions
				
			
		| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
#include "atom/browser/api/atom_api_web_contents.h"
 | 
					#include "atom/browser/api/atom_api_web_contents.h"
 | 
				
			||||||
#include "atom/common/native_mate_converters/callback.h"
 | 
					#include "atom/common/native_mate_converters/callback.h"
 | 
				
			||||||
#include "atom/common/native_mate_converters/file_path_converter.h"
 | 
					#include "atom/common/native_mate_converters/file_path_converter.h"
 | 
				
			||||||
 | 
					#include "atom/common/native_mate_converters/command_line_converter.h"
 | 
				
			||||||
#include "atom/common/node_includes.h"
 | 
					#include "atom/common/node_includes.h"
 | 
				
			||||||
#include "atom/common/options_switches.h"
 | 
					#include "atom/common/options_switches.h"
 | 
				
			||||||
#include "base/command_line.h"
 | 
					#include "base/command_line.h"
 | 
				
			||||||
| 
						 | 
					@ -268,7 +269,19 @@ v8::Local<v8::Value> App::DefaultSession(v8::Isolate* isolate) {
 | 
				
			||||||
    return v8::Local<v8::Value>::New(isolate, default_session_);
 | 
					    return v8::Local<v8::Value>::New(isolate, default_session_);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool App::MakeSingleInstance(const SingleInstanceCallback& callback) {
 | 
					bool App::MakeSingleInstance(const ProcessSingleton::NotificationCallback& callback) {
 | 
				
			||||||
 | 
					  auto browser = Browser::Get();
 | 
				
			||||||
 | 
					  browser->SetSingleInstanceCallback(&callback);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  switch(browser->GetSingleInstanceResult()) {
 | 
				
			||||||
 | 
					    case ProcessSingleton::NotifyResult::PROCESS_NONE:
 | 
				
			||||||
 | 
					      return false;
 | 
				
			||||||
 | 
					    case ProcessSingleton::NotifyResult::LOCK_ERROR:
 | 
				
			||||||
 | 
					    case ProcessSingleton::NotifyResult::PROFILE_IN_USE:
 | 
				
			||||||
 | 
					    case ProcessSingleton::NotifyResult::PROCESS_NOTIFIED:
 | 
				
			||||||
 | 
					      return true;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  return false;
 | 
					  return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "atom/browser/api/event_emitter.h"
 | 
					#include "atom/browser/api/event_emitter.h"
 | 
				
			||||||
#include "atom/browser/browser_observer.h"
 | 
					#include "atom/browser/browser_observer.h"
 | 
				
			||||||
 | 
					#include "atom/browser/process_singleton.h"
 | 
				
			||||||
#include "atom/common/native_mate_converters/callback.h"
 | 
					#include "atom/common/native_mate_converters/callback.h"
 | 
				
			||||||
#include "content/public/browser/gpu_data_manager_observer.h"
 | 
					#include "content/public/browser/gpu_data_manager_observer.h"
 | 
				
			||||||
#include "native_mate/handle.h"
 | 
					#include "native_mate/handle.h"
 | 
				
			||||||
| 
						 | 
					@ -25,8 +26,6 @@ namespace atom {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace api {
 | 
					namespace api {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using SingleInstanceCallback = base::Callback<void(const std::string&)>;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class App : public mate::EventEmitter,
 | 
					class App : public mate::EventEmitter,
 | 
				
			||||||
            public BrowserObserver,
 | 
					            public BrowserObserver,
 | 
				
			||||||
            public content::GpuDataManagerObserver {
 | 
					            public content::GpuDataManagerObserver {
 | 
				
			||||||
| 
						 | 
					@ -71,7 +70,7 @@ class App : public mate::EventEmitter,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void AllowNTLMCredentialsForAllDomains(bool should_allow);
 | 
					  void AllowNTLMCredentialsForAllDomains(bool should_allow);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool MakeSingleInstance(const SingleInstanceCallback& callback);
 | 
					  bool MakeSingleInstance(const ProcessSingleton::NotificationCallback& callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  std::string GetLocale();
 | 
					  std::string GetLocale();
 | 
				
			||||||
  v8::Local<v8::Value> DefaultSession(v8::Isolate* isolate);
 | 
					  v8::Local<v8::Value> DefaultSession(v8::Isolate* isolate);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,7 +171,7 @@ ProcessSingleton::NotifyResult Browser::GetSingleInstanceResult() {
 | 
				
			||||||
  return process_notify_result_;
 | 
					  return process_notify_result_;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
void Browser::SetSingleInstanceCallback(ProcessSingleton::NotificationCallback* callback) {
 | 
					void Browser::SetSingleInstanceCallback(const ProcessSingleton::NotificationCallback* callback) {
 | 
				
			||||||
  process_notify_callback_ = callback;
 | 
					  process_notify_callback_ = callback;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@ class Browser : public WindowListObserver {
 | 
				
			||||||
  void ClearRecentDocuments();
 | 
					  void ClearRecentDocuments();
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  ProcessSingleton::NotifyResult GetSingleInstanceResult();
 | 
					  ProcessSingleton::NotifyResult GetSingleInstanceResult();
 | 
				
			||||||
  void SetSingleInstanceCallback(ProcessSingleton::NotificationCallback* callback);
 | 
					  void SetSingleInstanceCallback(const ProcessSingleton::NotificationCallback* callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(OS_MACOSX)
 | 
					#if defined(OS_MACOSX)
 | 
				
			||||||
  // Bounce the dock icon.
 | 
					  // Bounce the dock icon.
 | 
				
			||||||
| 
						 | 
					@ -176,7 +176,7 @@ class Browser : public WindowListObserver {
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  scoped_ptr<AtomProcessSingleton> process_singleton_;
 | 
					  scoped_ptr<AtomProcessSingleton> process_singleton_;
 | 
				
			||||||
  ProcessSingleton::NotifyResult process_notify_result_;
 | 
					  ProcessSingleton::NotifyResult process_notify_result_;
 | 
				
			||||||
  ProcessSingleton::NotificationCallback* process_notify_callback_;
 | 
					  const ProcessSingleton::NotificationCallback* process_notify_callback_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(OS_WIN)
 | 
					#if defined(OS_WIN)
 | 
				
			||||||
  base::string16 app_user_model_id_;
 | 
					  base::string16 app_user_model_id_;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue