OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 | 4096 |
4097 TabLanguageDeterminedObserver* observer = new TabLanguageDeterminedObserver( | 4097 TabLanguageDeterminedObserver* observer = new TabLanguageDeterminedObserver( |
4098 this, reply_message, tab_contents, translate_bar); | 4098 this, reply_message, tab_contents, translate_bar); |
4099 // If the language for the page hasn't been loaded yet, then just make | 4099 // If the language for the page hasn't been loaded yet, then just make |
4100 // the observer, otherwise call observe directly. | 4100 // the observer, otherwise call observe directly. |
4101 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 4101 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
4102 tab_contents)->translate_tab_helper(); | 4102 tab_contents)->translate_tab_helper(); |
4103 std::string language = helper->language_state().original_language(); | 4103 std::string language = helper->language_state().original_language(); |
4104 if (!language.empty()) { | 4104 if (!language.empty()) { |
4105 observer->Observe(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, | 4105 observer->Observe(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, |
4106 content::Source<TabContents>(tab_contents), | 4106 content::Source<WebContents>(tab_contents), |
4107 content::Details<std::string>(&language)); | 4107 content::Details<std::string>(&language)); |
4108 } | 4108 } |
4109 } | 4109 } |
4110 | 4110 |
4111 // See SelectTranslateOption() in chrome/test/pyautolib/pyauto.py for sample | 4111 // See SelectTranslateOption() in chrome/test/pyautolib/pyauto.py for sample |
4112 // json input. | 4112 // json input. |
4113 // Sample json output: {} | 4113 // Sample json output: {} |
4114 void TestingAutomationProvider::SelectTranslateOption( | 4114 void TestingAutomationProvider::SelectTranslateOption( |
4115 Browser* browser, | 4115 Browser* browser, |
4116 DictionaryValue* args, | 4116 DictionaryValue* args, |
(...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6674 | 6674 |
6675 Send(reply_message_); | 6675 Send(reply_message_); |
6676 redirect_query_ = 0; | 6676 redirect_query_ = 0; |
6677 reply_message_ = NULL; | 6677 reply_message_ = NULL; |
6678 } | 6678 } |
6679 | 6679 |
6680 void TestingAutomationProvider::OnRemoveProvider() { | 6680 void TestingAutomationProvider::OnRemoveProvider() { |
6681 if (g_browser_process) | 6681 if (g_browser_process) |
6682 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6682 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6683 } | 6683 } |
OLD | NEW |