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

Side by Side Diff: chrome/browser/ui/views/translate/translate_bubble_view.cc

Issue 124833004: Translate New UX: Show bubble when clicking the icon within an automatic translate session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/translate/translate_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // is referred by Combobox's destructor. Before destroying the models, 132 // is referred by Combobox's destructor. Before destroying the models,
133 // removing the child views is needed. 133 // removing the child views is needed.
134 RemoveAllChildViews(true); 134 RemoveAllChildViews(true);
135 } 135 }
136 136
137 // static 137 // static
138 void TranslateBubbleView::ShowBubble(views::View* anchor_view, 138 void TranslateBubbleView::ShowBubble(views::View* anchor_view,
139 content::WebContents* web_contents, 139 content::WebContents* web_contents,
140 TranslateBubbleModel::ViewState type, 140 TranslateBubbleModel::ViewState type,
141 TranslateErrors::Type error_type) { 141 TranslateErrors::Type error_type) {
142 // During auto-translating, the bubble should not be shown.
143 if (type == TranslateBubbleModel::VIEW_STATE_TRANSLATING ||
144 type == TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE) {
145 TranslateTabHelper* translate_tab_helper =
146 TranslateTabHelper::FromWebContents(web_contents);
147 if (!translate_tab_helper ||
148 translate_tab_helper->language_state().InTranslateNavigation()) {
149 return;
150 }
151 }
152
153 if (IsShowing()) { 142 if (IsShowing()) {
154 // When the user reads the advanced setting panel, the bubble should not be 143 // When the user reads the advanced setting panel, the bubble should not be
155 // changed because he/she is focusing on the bubble. 144 // changed because he/she is focusing on the bubble.
156 if (translate_bubble_view_->web_contents() == web_contents && 145 if (translate_bubble_view_->web_contents() == web_contents &&
157 translate_bubble_view_->model()->GetViewState() == 146 translate_bubble_view_->model()->GetViewState() ==
158 TranslateBubbleModel::VIEW_STATE_ADVANCED) { 147 TranslateBubbleModel::VIEW_STATE_ADVANCED) {
159 return; 148 return;
160 } 149 }
161 if (type != TranslateBubbleModel::VIEW_STATE_ERROR) 150 if (type != TranslateBubbleModel::VIEW_STATE_ERROR)
162 translate_bubble_view_->SwitchView(type); 151 translate_bubble_view_->SwitchView(type);
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 model_->ShouldAlwaysTranslate()); 789 model_->ShouldAlwaysTranslate());
801 } 790 }
802 791
803 base::string16 label; 792 base::string16 label;
804 if (model_->IsPageTranslatedInCurrentLanguages()) 793 if (model_->IsPageTranslatedInCurrentLanguages())
805 label = l10n_util::GetStringUTF16(IDS_DONE); 794 label = l10n_util::GetStringUTF16(IDS_DONE);
806 else 795 else
807 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); 796 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT);
808 advanced_done_button_->SetText(label); 797 advanced_done_button_->SetText(label);
809 } 798 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698