| Index: chrome/browser/search/contextual_search_service.h
|
| diff --git a/chrome/browser/search/contextual_search_service.h b/chrome/browser/search/contextual_search_service.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a1efefab1fca93cf0b8f6f645c13dc1c181712d2
|
| --- /dev/null
|
| +++ b/chrome/browser/search/contextual_search_service.h
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_
|
| +#define CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_
|
| +
|
| +#include "base/memory/singleton.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +
|
| +// Provides a singleton service for Contextual Search.
|
| +// Tracks render process host IDs that are associated with ContextualSearch.
|
| +class ContextualSearchService : public content::NotificationObserver {
|
| + public:
|
| + static ContextualSearchService* GetInstance();
|
| +
|
| + // Add, remove, and query RenderProcessHost IDs that are associated with
|
| + // Contextual Search processes.
|
| + void SetContextualSearchProcess(int process_id);
|
| + bool IsContextualSearchProcess(int process_id) const;
|
| +
|
| + private:
|
| + // Use GetInstance instead of constructing.
|
| + ContextualSearchService();
|
| + ~ContextualSearchService() override;
|
| +
|
| + // Singleton:
|
| + friend struct base::DefaultSingletonTraits<ContextualSearchService>;
|
| +
|
| + // content::NotificationObserver:
|
| + void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) override;
|
| +
|
| + void OnRendererProcessTerminated(int process_id);
|
| +
|
| + // The process id associated with Contextual Search processes.
|
| + int process_id_;
|
| +
|
| + content::NotificationRegistrar registrar_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ContextualSearchService);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_SEARCH_CONTEXTUAL_SEARCH_SERVICE_H_
|
|
|