Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 void BrowserView::ShowTranslateBubble(content::WebContents* web_contents, | 1161 void BrowserView::ShowTranslateBubble(content::WebContents* web_contents, |
| 1162 translate::TranslateStep step, | 1162 translate::TranslateStep step, |
| 1163 TranslateErrors::Type error_type) { | 1163 TranslateErrors::Type error_type) { |
| 1164 if (contents_web_view_->HasFocus() && | 1164 if (contents_web_view_->HasFocus() && |
| 1165 !GetLocationBarView()->IsMouseHovered()) { | 1165 !GetLocationBarView()->IsMouseHovered()) { |
| 1166 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); | 1166 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); |
| 1167 if (rvh->IsFocusedElementEditable()) | 1167 if (rvh->IsFocusedElementEditable()) |
| 1168 return; | 1168 return; |
| 1169 | |
| 1170 if (IsOffTheRecord()) | |
|
sky
2014/06/19 15:46:46
This code is not platform specific. Can it be move
hajimehoshi
2014/06/20 11:38:45
Done. Moved to ChromeTranslateClient.
BrowserComm
| |
| 1171 return; | |
| 1172 | |
| 1173 PrefService* pref = browser_->profile()->GetOriginalProfile()->GetPrefs(); | |
| 1174 scoped_ptr<TranslatePrefs> translate_prefs = | |
| 1175 ChromeTranslateClient::CreateTranslatePrefs(pref); | |
| 1176 if (translate_prefs->IsBubbleHidden()) | |
| 1177 return; | |
| 1169 } | 1178 } |
| 1170 | 1179 |
| 1171 ChromeTranslateClient* chrome_translate_client = | 1180 ChromeTranslateClient* chrome_translate_client = |
| 1172 ChromeTranslateClient::FromWebContents(web_contents); | 1181 ChromeTranslateClient::FromWebContents(web_contents); |
| 1173 LanguageState& language_state = chrome_translate_client->GetLanguageState(); | 1182 LanguageState& language_state = chrome_translate_client->GetLanguageState(); |
| 1174 language_state.SetTranslateEnabled(true); | 1183 language_state.SetTranslateEnabled(true); |
| 1175 | 1184 |
| 1176 TranslateBubbleView::ShowBubble( | 1185 TranslateBubbleView::ShowBubble( |
| 1177 GetToolbarView()->GetTranslateBubbleAnchor(), web_contents, step, | 1186 GetToolbarView()->GetTranslateBubbleAnchor(), web_contents, step, |
| 1178 error_type); | 1187 error_type); |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2546 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2555 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2547 gfx::Point icon_bottom( | 2556 gfx::Point icon_bottom( |
| 2548 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2557 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2549 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2558 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2550 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2559 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2551 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2560 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2552 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2561 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2553 } | 2562 } |
| 2554 return top_arrow_height; | 2563 return top_arrow_height; |
| 2555 } | 2564 } |
| OLD | NEW |