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

Unified Diff: chrome/browser/browser_process_impl.cc

Issue 174162: Don't show "Inspect Element" in the context menu if we can't inspect. (Closed)
Patch Set: ... Created 11 years, 4 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_process_impl.h ('k') | chrome/browser/gtk/standard_menus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_process_impl.cc
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 2168d6490679e8c3d1a1c865c09dd35d67018ccf..80243704f65149c86e98fad5d5d7388aebaf5ab8 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "base/clipboard.h"
#include "base/command_line.h"
+#include "base/file_util.h"
#include "base/path_service.h"
#include "base/thread.h"
#include "base/waitable_event.h"
@@ -130,7 +131,8 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
module_ref_count_(0),
memory_model_(HIGH_MEMORY_MODEL),
checked_for_new_frames_(false),
- using_new_frames_(false) {
+ using_new_frames_(false),
+ have_inspector_files_(true) {
g_browser_process = this;
clipboard_.reset(new Clipboard);
main_notification_service_.reset(new NotificationService);
@@ -422,3 +424,30 @@ void BrowserProcessImpl::CreateGoogleURLTracker() {
scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker);
google_url_tracker_.swap(google_url_tracker);
}
+
+// The BrowserProcess object must outlive the file thread so we use traits
+// which don't do any management.
+template <>
+struct RunnableMethodTraits<BrowserProcessImpl> {
+ static void RetainCallee(BrowserProcessImpl*) {}
+ static void ReleaseCallee(BrowserProcessImpl*) {}
+};
+
+void BrowserProcessImpl::CheckForInspectorFiles() {
+ file_thread()->message_loop()->PostTask
+ (FROM_HERE,
+ NewRunnableMethod(this, &BrowserProcessImpl::DoInspectorFilesCheck));
+}
+
+void BrowserProcessImpl::DoInspectorFilesCheck() {
+ // Runs on FILE thread.
+ DCHECK(file_thread_->message_loop() == MessageLoop::current());
+ bool result = false;
+
+ FilePath inspector_dir;
+ if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) {
+ result = file_util::PathExists(inspector_dir);
+ }
+
+ have_inspector_files_ = result;
+}
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/gtk/standard_menus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698