diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 00:34:09 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 00:34:09 +0000 |
commit | 6641bf667244ed108b2d300766896f6fa84a6f4e (patch) | |
tree | 2e82c7be2c10139bddf35f8e72b47b49bcbb3ce0 /chrome/browser/browser_process_impl.cc | |
parent | 92ac0b815ab28656139ecbbe3af11edaecfce61a (diff) | |
download | chromium_src-6641bf667244ed108b2d300766896f6fa84a6f4e.zip chromium_src-6641bf667244ed108b2d300766896f6fa84a6f4e.tar.gz chromium_src-6641bf667244ed108b2d300766896f6fa84a6f4e.tar.bz2 |
Don't show "Inspect Element" in the context menu if we can't inspect.
Ubuntu want to ship with the inspector files in a separate package and
having menu items which are broken isn't nice.
http://codereview.chromium.org/174162
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_process_impl.cc')
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 2168d64..8024370 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; +} |