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

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

Issue 228483003: Remove most content-level dependencies from TranslateManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 6 years, 8 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/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "url/gurl.h"
15 16
16 ContentTranslateDriver::ContentTranslateDriver( 17 ContentTranslateDriver::ContentTranslateDriver(
17 content::NavigationController* nav_controller) 18 content::NavigationController* nav_controller)
18 : navigation_controller_(nav_controller), 19 : navigation_controller_(nav_controller),
19 language_state_(this), 20 language_state_(this),
20 observer_(NULL) { 21 observer_(NULL) {
21 DCHECK(navigation_controller_); 22 DCHECK(navigation_controller_);
22 } 23 }
23 24
24 ContentTranslateDriver::~ContentTranslateDriver() {} 25 ContentTranslateDriver::~ContentTranslateDriver() {}
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 87 }
87 88
88 content::WebContents* web_contents = navigation_controller_->GetWebContents(); 89 content::WebContents* web_contents = navigation_controller_->GetWebContents();
89 web_contents->GetRenderViewHost()->Send(new ChromeViewMsg_RevertTranslation( 90 web_contents->GetRenderViewHost()->Send(new ChromeViewMsg_RevertTranslation(
90 web_contents->GetRenderViewHost()->GetRoutingID(), entry->GetPageID())); 91 web_contents->GetRenderViewHost()->GetRoutingID(), entry->GetPageID()));
91 } 92 }
92 93
93 bool ContentTranslateDriver::IsOffTheRecord() { 94 bool ContentTranslateDriver::IsOffTheRecord() {
94 return navigation_controller_->GetBrowserContext()->IsOffTheRecord(); 95 return navigation_controller_->GetBrowserContext()->IsOffTheRecord();
95 } 96 }
97
98 const std::string& ContentTranslateDriver::GetContentsMimeType() {
99 return navigation_controller_->GetWebContents()->GetContentsMimeType();
100 }
101
102 const GURL& ContentTranslateDriver::GetLastCommittedURL() {
103 return navigation_controller_->GetWebContents()->GetLastCommittedURL();
104 }
105
106 const GURL& ContentTranslateDriver::GetActiveURL() {
107 content::NavigationEntry* entry = navigation_controller_->GetActiveEntry();
droger 2014/04/08 12:01:28 Not sure if we can do something about it, but GetA
blundell 2014/04/08 12:46:02 The problem is that GetActiveEntry() and GetVisibl
droger 2014/04/08 13:01:21 Yes it does answer my question. Thanks.
108 if (!entry)
109 return GURL::EmptyGURL();
110 return entry->GetURL();
111 }
112
113 const GURL& ContentTranslateDriver::GetVisibleURL() {
114 return navigation_controller_->GetWebContents()->GetVisibleURL();
115 }
116
117 bool ContentTranslateDriver::HasCurrentPage() {
118 return (navigation_controller_->GetActiveEntry() != NULL);
119 }
120
121 int ContentTranslateDriver::GetCurrentPageID() {
122 DCHECK(HasCurrentPage());
123 content::NavigationEntry* entry = navigation_controller_->GetActiveEntry();
124 return entry->GetPageID();
125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698