OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } // namespace | 138 } // namespace |
139 | 139 |
140 // static | 140 // static |
141 base::LazyInstance<std::set<std::string> > | 141 base::LazyInstance<std::set<std::string> > |
142 TranslateManager::supported_languages_(base::LINKER_INITIALIZED); | 142 TranslateManager::supported_languages_(base::LINKER_INITIALIZED); |
143 | 143 |
144 TranslateManager::~TranslateManager() { | 144 TranslateManager::~TranslateManager() { |
145 } | 145 } |
146 | 146 |
147 // static | 147 // static |
| 148 TranslateManager* TranslateManager::GetInstance() { |
| 149 return Singleton<TranslateManager>::get(); |
| 150 } |
| 151 |
| 152 // static |
148 bool TranslateManager::IsTranslatableURL(const GURL& url) { | 153 bool TranslateManager::IsTranslatableURL(const GURL& url) { |
149 return !url.SchemeIs("chrome") && !url.SchemeIs("ftp"); | 154 return !url.SchemeIs("chrome") && !url.SchemeIs("ftp"); |
150 } | 155 } |
151 | 156 |
152 // static | 157 // static |
153 void TranslateManager::GetSupportedLanguages( | 158 void TranslateManager::GetSupportedLanguages( |
154 std::vector<std::string>* languages) { | 159 std::vector<std::string>* languages) { |
155 DCHECK(languages && languages->empty()); | 160 DCHECK(languages && languages->empty()); |
156 for (size_t i = 0; i < arraysize(kSupportedLanguages); ++i) | 161 for (size_t i = 0; i < arraysize(kSupportedLanguages); ++i) |
157 languages->push_back(kSupportedLanguages[i]); | 162 languages->push_back(kSupportedLanguages[i]); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate( | 615 TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate( |
611 TabContents* tab) { | 616 TabContents* tab) { |
612 for (int i = 0; i < tab->infobar_delegate_count(); ++i) { | 617 for (int i = 0; i < tab->infobar_delegate_count(); ++i) { |
613 TranslateInfoBarDelegate* delegate = | 618 TranslateInfoBarDelegate* delegate = |
614 tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 619 tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
615 if (delegate) | 620 if (delegate) |
616 return delegate; | 621 return delegate; |
617 } | 622 } |
618 return NULL; | 623 return NULL; |
619 } | 624 } |
OLD | NEW |