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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 289983002: Show the Translate bubble when the content web view is not focused (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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_tab_helper.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 const std::string& extension_id) { 1152 const std::string& extension_id) {
1153 BookmarkAppBubbleView::ShowBubble(GetToolbarView(), 1153 BookmarkAppBubbleView::ShowBubble(GetToolbarView(),
1154 browser_->profile(), 1154 browser_->profile(),
1155 web_app_info, 1155 web_app_info,
1156 extension_id); 1156 extension_id);
1157 } 1157 }
1158 1158
1159 void BrowserView::ShowTranslateBubble(content::WebContents* web_contents, 1159 void BrowserView::ShowTranslateBubble(content::WebContents* web_contents,
1160 translate::TranslateStep step, 1160 translate::TranslateStep step,
1161 TranslateErrors::Type error_type) { 1161 TranslateErrors::Type error_type) {
1162 if (contents_web_view_->HasFocus() &&
1163 !GetLocationBarView()->IsMouseHovered()) {
sky 2014/05/15 16:34:56 Why the hovered check? What about users that are u
hajimehoshi 2014/05/16 03:49:50 It's because when an input element is focused and
sky 2014/05/16 17:00:54 Sorry, I still don't get it. Could you outline in
1164 content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
1165 if (rvh->IsFocusedElementEditable())
1166 return;
1167 }
1168
1162 TranslateTabHelper* translate_tab_helper = 1169 TranslateTabHelper* translate_tab_helper =
1163 TranslateTabHelper::FromWebContents(web_contents); 1170 TranslateTabHelper::FromWebContents(web_contents);
1164 LanguageState& language_state = translate_tab_helper->GetLanguageState(); 1171 LanguageState& language_state = translate_tab_helper->GetLanguageState();
1165 language_state.SetTranslateEnabled(true); 1172 language_state.SetTranslateEnabled(true);
1166 1173
1167 TranslateBubbleView::ShowBubble( 1174 TranslateBubbleView::ShowBubble(
1168 GetToolbarView()->GetTranslateBubbleAnchor(), web_contents, step, 1175 GetToolbarView()->GetTranslateBubbleAnchor(), web_contents, step,
1169 error_type); 1176 error_type);
1170 } 1177 }
1171 1178
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2533 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2540 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2534 gfx::Point icon_bottom( 2541 gfx::Point icon_bottom(
2535 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2542 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2536 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2543 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2537 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2544 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2538 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2545 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2539 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2546 top_arrow_height = infobar_top.y() - icon_bottom.y();
2540 } 2547 }
2541 return top_arrow_height; 2548 return top_arrow_height;
2542 } 2549 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_tab_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698