Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1595)

Unified Diff: chrome/browser/greasemonkey_master.h

Issue 7254: Initial Greasemonkey support (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser.vcproj ('k') | chrome/browser/greasemonkey_master.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/greasemonkey_master.h
===================================================================
--- chrome/browser/greasemonkey_master.h (revision 0)
+++ chrome/browser/greasemonkey_master.h (revision 0)
@@ -0,0 +1,47 @@
+// Copyright (c) 2008 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_GREASEMONKEY_MASTER_H__
+#define CHROME_BROWSER_GREASEMONKEY_MASTER_H__
+
+#include <vector>
+
+#include "base/process.h"
+#include "base/scoped_ptr.h"
+#include "base/shared_memory.h"
+
+// Manages a segment of shared memory that contains the Greasemonkey scripts the
+// user has installed.
+class GreasemonkeyMaster {
+ public:
+ GreasemonkeyMaster()
+ : shared_memory_serial_(0) {}
+
+ // Reloads scripts from disk into a new chunk of shared memory and notifies
+ // renderers.
+ bool UpdateScripts();
+
+ // Creates a handle to the shared memory that can be used in the specified
+ // process.
+ bool ShareToProcess(ProcessHandle process, SharedMemoryHandle* new_handle);
+
+ // Gets the segment of shared memory for the scripts.
+ SharedMemory* GetSharedMemory() const {
+ return shared_memory_.get();
+ }
+
+ private:
+ // Contains the scripts that were found the last time UpdateScripts() was
+ // called.
+ scoped_ptr<SharedMemory> shared_memory_;
+
+ // A counter that is incremented each time a new shared memory segment is
+ // created. This is used to uniquely identify segments created at different
+ // times by this class.
+ int shared_memory_serial_;
+
+ DISALLOW_COPY_AND_ASSIGN(GreasemonkeyMaster);
+};
+
+#endif // CHROME_BROWSER_GREASEMONKEY_MASTER_H__
« no previous file with comments | « chrome/browser/browser.vcproj ('k') | chrome/browser/greasemonkey_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698