diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 20:17:00 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 20:17:00 +0000 |
commit | f345876ca7aac5ff6f4e08242891b800c48cedcd (patch) | |
tree | d8096238c5a3acad0f08a69f45744d5c843875f5 /chrome/browser/extensions/extension_tabs_module.cc | |
parent | f7b7ffe4267e517b99c24391a51622f29c0476f0 (diff) | |
download | chromium_src-f345876ca7aac5ff6f4e08242891b800c48cedcd.zip chromium_src-f345876ca7aac5ff6f4e08242891b800c48cedcd.tar.gz chromium_src-f345876ca7aac5ff6f4e08242891b800c48cedcd.tar.bz2 |
Reverting the CLD CL altogether, the reliability bot is still red.
BUG=30681
TEST=None
TBR=brettw
Review URL: http://codereview.chromium.org/504048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_tabs_module.cc')
-rw-r--r-- | chrome/browser/extensions/extension_tabs_module.cc | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index a97e098..64ee348 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -839,24 +839,15 @@ bool DetectTabLanguageFunction::RunImpl() { return false; } - AddRef(); // Balanced in GotLanguage() - - NavigationEntry* entry = contents->controller().GetActiveEntry(); - if (entry) { - std::string language = entry->language(); - if (!language.empty()) { - // Delay the callback invocation until after the current JS call has - // returned. - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &DetectTabLanguageFunction::GotLanguage, language)); - return true; - } - } - // The tab contents does not know its language yet. Let's wait until it - // receives it. + // Figure out what language |contents| contains. This sends an async call via + // the browser to the renderer to determine the language of the tab the + // renderer has. The renderer sends back the language of the tab after the + // tab loads (it may be delayed) to the browser, which in turn notifies this + // object that the language has been received. + contents->GetPageLanguage(); registrar_.Add(this, NotificationType::TAB_LANGUAGE_DETERMINED, - Source<RenderViewHost>(contents->render_view_host())); - + NotificationService::AllSources()); + AddRef(); // balanced in Observe() return true; } @@ -865,16 +856,9 @@ void DetectTabLanguageFunction::Observe(NotificationType type, const NotificationDetails& details) { DCHECK(type == NotificationType::TAB_LANGUAGE_DETERMINED); std::string language(*Details<std::string>(details).ptr()); - registrar_.Remove(this, NotificationType::TAB_LANGUAGE_DETERMINED, source); - - GotLanguage(language); -} - -void DetectTabLanguageFunction::GotLanguage(const std::string& language) { result_.reset(Value::CreateStringValue(language.c_str())); SendResponse(true); - - Release(); // Balanced in Run() + Release(); // balanced in Run() } // static helpers |