OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/translate/translate_bubble_view.h" | 5 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/i18n/string_compare.h" | 11 #include "base/i18n/string_compare.h" |
12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/translate/translate_manager.h" | 18 #include "chrome/browser/translate/translate_manager.h" |
19 #include "chrome/browser/translate/translate_tab_helper.h" | 19 #include "chrome/browser/translate/translate_tab_helper.h" |
20 #include "chrome/browser/translate/translate_ui_delegate.h" | 20 #include "chrome/browser/translate/translate_ui_delegate.h" |
| 21 #include "chrome/browser/ui/chrome_pages.h" |
21 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" | 22 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 #include "components/translate/core/browser/translate_download_manager.h" | 24 #include "components/translate/core/browser/translate_download_manager.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/models/combobox_model.h" | 28 #include "ui/base/models/combobox_model.h" |
28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/views/controls/button/checkbox.h" | 30 #include "ui/views/controls/button/checkbox.h" |
30 #include "ui/views/controls/button/label_button.h" | 31 #include "ui/views/controls/button/label_button.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 391 } |
391 | 392 |
392 void TranslateBubbleView::HandleLinkClicked( | 393 void TranslateBubbleView::HandleLinkClicked( |
393 TranslateBubbleView::LinkID sender_id) { | 394 TranslateBubbleView::LinkID sender_id) { |
394 switch (sender_id) { | 395 switch (sender_id) { |
395 case LINK_ID_ADVANCED: { | 396 case LINK_ID_ADVANCED: { |
396 SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); | 397 SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); |
397 break; | 398 break; |
398 } | 399 } |
399 case LINK_ID_LANGUAGE_SETTINGS: { | 400 case LINK_ID_LANGUAGE_SETTINGS: { |
400 std::string url = std::string(chrome::kChromeUISettingsURL) + | 401 GURL url = chrome::GetSettingsUrl(chrome::kLanguageOptionsSubPage); |
401 chrome::kLanguageOptionsSubPage; | |
402 web_contents()->OpenURL(content::OpenURLParams( | 402 web_contents()->OpenURL(content::OpenURLParams( |
403 GURL(url), | 403 url, |
404 content::Referrer(), | 404 content::Referrer(), |
405 NEW_FOREGROUND_TAB, | 405 NEW_FOREGROUND_TAB, |
406 content::PAGE_TRANSITION_LINK, | 406 content::PAGE_TRANSITION_LINK, |
407 false)); | 407 false)); |
408 break; | 408 break; |
409 } | 409 } |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 void TranslateBubbleView::HandleComboboxPerformAction( | 413 void TranslateBubbleView::HandleComboboxPerformAction( |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 model_->ShouldAlwaysTranslate()); | 787 model_->ShouldAlwaysTranslate()); |
788 } | 788 } |
789 | 789 |
790 base::string16 label; | 790 base::string16 label; |
791 if (model_->IsPageTranslatedInCurrentLanguages()) | 791 if (model_->IsPageTranslatedInCurrentLanguages()) |
792 label = l10n_util::GetStringUTF16(IDS_DONE); | 792 label = l10n_util::GetStringUTF16(IDS_DONE); |
793 else | 793 else |
794 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 794 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
795 advanced_done_button_->SetText(label); | 795 advanced_done_button_->SetText(label); |
796 } | 796 } |
OLD | NEW |