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

Side by Side Diff: chrome/browser/translate/translate_manager.cc

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 (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/translate/translate_manager.h" 5 #include "chrome/browser/translate/translate_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "content/public/browser/notification_source.h" 43 #include "content/public/browser/notification_source.h"
44 #include "content/public/browser/notification_types.h" 44 #include "content/public/browser/notification_types.h"
45 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
46 #include "content/public/browser/web_contents.h" 46 #include "content/public/browser/web_contents.h"
47 #include "content/public/common/url_fetcher.h" 47 #include "content/public/common/url_fetcher.h"
48 #include "grit/browser_resources.h" 48 #include "grit/browser_resources.h"
49 #include "net/base/escape.h" 49 #include "net/base/escape.h"
50 #include "net/url_request/url_request_status.h" 50 #include "net/url_request/url_request_status.h"
51 #include "ui/base/resource/resource_bundle.h" 51 #include "ui/base/resource/resource_bundle.h"
52 52
53 using content::NavigationController;
53 using content::NavigationEntry; 54 using content::NavigationEntry;
54 using content::WebContents; 55 using content::WebContents;
55 56
56 namespace { 57 namespace {
57 58
58 // The list of languages the Google translation server supports. 59 // The list of languages the Google translation server supports.
59 // For information, here is the list of languages that Chrome can be run in 60 // For information, here is the list of languages that Chrome can be run in
60 // but that the translation server does not support: 61 // but that the translation server does not support:
61 // am Amharic 62 // am Amharic
62 // bn Bengali 63 // bn Bengali
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 bool TranslateManager::IsSupportedLanguage(const std::string& page_language) { 255 bool TranslateManager::IsSupportedLanguage(const std::string& page_language) {
255 InitSupportedLanguages(); 256 InitSupportedLanguages();
256 return supported_languages_.Pointer()->count(page_language) != 0; 257 return supported_languages_.Pointer()->count(page_language) != 0;
257 } 258 }
258 259
259 void TranslateManager::Observe(int type, 260 void TranslateManager::Observe(int type,
260 const content::NotificationSource& source, 261 const content::NotificationSource& source,
261 const content::NotificationDetails& details) { 262 const content::NotificationDetails& details) {
262 switch (type) { 263 switch (type) {
263 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { 264 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
264 content::NavigationController* controller = 265 NavigationController* controller =
265 content::Source<content::NavigationController>(source).ptr(); 266 content::Source<NavigationController>(source).ptr();
266 content::LoadCommittedDetails* load_details = 267 content::LoadCommittedDetails* load_details =
267 content::Details<content::LoadCommittedDetails>(details).ptr(); 268 content::Details<content::LoadCommittedDetails>(details).ptr();
268 NavigationEntry* entry = controller->GetActiveEntry(); 269 NavigationEntry* entry = controller->GetActiveEntry();
269 if (!entry) { 270 if (!entry) {
270 NOTREACHED(); 271 NOTREACHED();
271 return; 272 return;
272 } 273 }
273 274
274 TabContentsWrapper* wrapper = 275 TabContentsWrapper* wrapper =
275 TabContentsWrapper::GetCurrentWrapperForContents( 276 TabContentsWrapper::GetCurrentWrapperForContents(
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); 835 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper();
835 836
836 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 837 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
837 TranslateInfoBarDelegate* delegate = 838 TranslateInfoBarDelegate* delegate =
838 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); 839 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
839 if (delegate) 840 if (delegate)
840 return delegate; 841 return delegate;
841 } 842 }
842 return NULL; 843 return NULL;
843 } 844 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/tab_strip_model_unittest.cc ('k') | chrome/browser/translate/translate_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698