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

Unified Diff: chrome/browser/translate/options_menu_model.cc

Issue 292513002: Remove dependency of TranslateInfobarDelegate on chrome/ and content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | chrome/browser/translate/translate_infobar_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/options_menu_model.cc
diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc
index 6422f1673cbfc61612ed6b50c2839030c66a05f4..a0b81e9a7682ad02d0acd3de621814b610a01025 100644
--- a/chrome/browser/translate/options_menu_model.cc
+++ b/chrome/browser/translate/options_menu_model.cc
@@ -7,24 +7,27 @@
#include "base/metrics/histogram.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/web_contents.h"
+#include "components/translate/core/browser/translate_client.h"
+#include "components/translate/core/browser/translate_driver.h"
#include "grit/component_strings.h"
#include "grit/locale_settings.h"
#include "ui/base/l10n/l10n_util.h"
-using content::NavigationEntry;
-using content::OpenURLParams;
-using content::Referrer;
-using content::WebContents;
+namespace {
+
+const char kAboutGoogleTranslateURL[] =
blundell 2014/05/19 12:38:42 Why did you move this here, out of curiosity?
+#if defined(OS_CHROMEOS)
+ "https://support.google.com/chromeos/?p=ib_translation_bar";
+#else
+ "https://support.google.com/chrome/?p=ib_translation_bar";
+#endif
+
+} // namespace
OptionsMenuModel::OptionsMenuModel(
TranslateInfoBarDelegate* translate_delegate)
: ui::SimpleMenuModel(this),
translate_infobar_delegate_(translate_delegate) {
- // |translate_delegate| must already be owned.
- DCHECK(translate_infobar_delegate_->GetWebContents());
-
base::string16 original_language = translate_delegate->language_name_at(
translate_delegate->original_language_index());
base::string16 target_language = translate_delegate->language_name_at(
@@ -121,12 +124,11 @@ void OptionsMenuModel::ExecuteCommand(int command_id, int event_flags) {
break;
case IDC_TRANSLATE_OPTIONS_ABOUT: {
- WebContents* web_contents = translate_infobar_delegate_->GetWebContents();
blundell 2014/05/19 12:38:42 It seems like it would also be OK for this code to
- if (web_contents) {
- OpenURLParams params(
- GURL(chrome::kAboutGoogleTranslateURL), Referrer(),
- NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false);
- web_contents->OpenURL(params);
+ TranslateClient* translate_client =
+ translate_infobar_delegate_->GetTranslateClient();
+ if (translate_client) {
+ translate_client->GetTranslateDriver()->OpenUrlInNewTab(
+ GURL(kAboutGoogleTranslateURL));
}
break;
}
« no previous file with comments | « no previous file | chrome/browser/translate/translate_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698