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

Side by Side Diff: components/translate/content/browser/content_translate_driver.cc

Issue 292513002: Remove dependency of TranslateInfobarDelegate on chrome/ and content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/logging.h" 7 #include "base/logging.h"
8 #include "components/translate/content/common/translate_messages.h" 8 #include "components/translate/content/common/translate_messages.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
11 #include "content/public/browser/navigation_details.h" 11 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/page_navigator.h"
13 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/referrer.h"
15 #include "url/gurl.h" 17 #include "url/gurl.h"
16 18
17 ContentTranslateDriver::ContentTranslateDriver( 19 ContentTranslateDriver::ContentTranslateDriver(
18 content::NavigationController* nav_controller) 20 content::NavigationController* nav_controller)
19 : navigation_controller_(nav_controller), 21 : navigation_controller_(nav_controller),
20 language_state_(this), 22 language_state_(this),
21 observer_(NULL) { 23 observer_(NULL) {
22 DCHECK(navigation_controller_); 24 DCHECK(navigation_controller_);
23 } 25 }
24 26
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 118
117 bool ContentTranslateDriver::HasCurrentPage() { 119 bool ContentTranslateDriver::HasCurrentPage() {
118 return (navigation_controller_->GetActiveEntry() != NULL); 120 return (navigation_controller_->GetActiveEntry() != NULL);
119 } 121 }
120 122
121 int ContentTranslateDriver::GetCurrentPageID() { 123 int ContentTranslateDriver::GetCurrentPageID() {
122 DCHECK(HasCurrentPage()); 124 DCHECK(HasCurrentPage());
123 content::NavigationEntry* entry = navigation_controller_->GetActiveEntry(); 125 content::NavigationEntry* entry = navigation_controller_->GetActiveEntry();
124 return entry->GetPageID(); 126 return entry->GetPageID();
125 } 127 }
128
129 void ContentTranslateDriver::OpenUrlInNewTab(const GURL& url) {
130 content::OpenURLParams params(url,
131 content::Referrer(),
132 NEW_FOREGROUND_TAB,
133 content::PAGE_TRANSITION_LINK,
134 false);
135 navigation_controller_->GetWebContents()->OpenURL(params);
136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698