OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/translate/content/browser/content_translate_driver.h" | 5 #include "components/translate/content/browser/content_translate_driver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 const GURL& ContentTranslateDriver::GetVisibleURL() { | 140 const GURL& ContentTranslateDriver::GetVisibleURL() { |
141 return navigation_controller_->GetWebContents()->GetVisibleURL(); | 141 return navigation_controller_->GetWebContents()->GetVisibleURL(); |
142 } | 142 } |
143 | 143 |
144 bool ContentTranslateDriver::HasCurrentPage() { | 144 bool ContentTranslateDriver::HasCurrentPage() { |
145 return (navigation_controller_->GetLastCommittedEntry() != NULL); | 145 return (navigation_controller_->GetLastCommittedEntry() != NULL); |
146 } | 146 } |
147 | 147 |
148 void ContentTranslateDriver::OpenUrlInNewTab(const GURL& url) { | 148 void ContentTranslateDriver::OpenUrlInNewTab(const GURL& url) { |
149 content::OpenURLParams params(url, | 149 content::OpenURLParams params(url, content::Referrer(), |
150 content::Referrer(), | 150 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
151 NEW_FOREGROUND_TAB, | 151 ui::PAGE_TRANSITION_LINK, false); |
152 ui::PAGE_TRANSITION_LINK, | |
153 false); | |
154 navigation_controller_->GetWebContents()->OpenURL(params); | 152 navigation_controller_->GetWebContents()->OpenURL(params); |
155 } | 153 } |
156 | 154 |
157 // content::WebContentsObserver methods | 155 // content::WebContentsObserver methods |
158 | 156 |
159 void ContentTranslateDriver::NavigationEntryCommitted( | 157 void ContentTranslateDriver::NavigationEntryCommitted( |
160 const content::LoadCommittedDetails& load_details) { | 158 const content::LoadCommittedDetails& load_details) { |
161 // Check whether this is a reload: When doing a page reload, the | 159 // Check whether this is a reload: When doing a page reload, the |
162 // TranslateLanguageDetermined IPC is not sent so the translation needs to be | 160 // TranslateLanguageDetermined IPC is not sent so the translation needs to be |
163 // explicitly initiated. | 161 // explicitly initiated. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 251 |
254 translate_manager_->PageTranslated( | 252 translate_manager_->PageTranslated( |
255 original_lang, translated_lang, error_type); | 253 original_lang, translated_lang, error_type); |
256 FOR_EACH_OBSERVER( | 254 FOR_EACH_OBSERVER( |
257 Observer, | 255 Observer, |
258 observer_list_, | 256 observer_list_, |
259 OnPageTranslated(original_lang, translated_lang, error_type)); | 257 OnPageTranslated(original_lang, translated_lang, error_type)); |
260 } | 258 } |
261 | 259 |
262 } // namespace translate | 260 } // namespace translate |
OLD | NEW |