| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 autofill::SaveCardBubbleView* BrowserView::ShowSaveCreditCardBubble( | 1201 autofill::SaveCardBubbleView* BrowserView::ShowSaveCreditCardBubble( |
| 1202 content::WebContents* web_contents, | 1202 content::WebContents* web_contents, |
| 1203 autofill::SaveCardBubbleController* controller, | 1203 autofill::SaveCardBubbleController* controller, |
| 1204 bool is_user_gesture) { | 1204 bool is_user_gesture) { |
| 1205 return toolbar_->ShowSaveCreditCardBubble(web_contents, controller, | 1205 return toolbar_->ShowSaveCreditCardBubble(web_contents, controller, |
| 1206 is_user_gesture); | 1206 is_user_gesture); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 void BrowserView::ShowTranslateBubble( | 1209 ShowTranslateBubbleResult BrowserView::ShowTranslateBubble( |
| 1210 content::WebContents* web_contents, | 1210 content::WebContents* web_contents, |
| 1211 translate::TranslateStep step, | 1211 translate::TranslateStep step, |
| 1212 translate::TranslateErrors::Type error_type, | 1212 translate::TranslateErrors::Type error_type, |
| 1213 bool is_user_gesture) { | 1213 bool is_user_gesture) { |
| 1214 if (contents_web_view_->HasFocus() && | 1214 if (contents_web_view_->HasFocus() && |
| 1215 !GetLocationBarView()->IsMouseHovered()) { | 1215 !GetLocationBarView()->IsMouseHovered()) { |
| 1216 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); | 1216 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); |
| 1217 if (rvh->IsFocusedElementEditable()) | 1217 if (rvh->IsFocusedElementEditable()) |
| 1218 return; | 1218 return ShowTranslateBubbleResult::EDITABLE_FIELD_IS_ACTIVE; |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 translate::LanguageState& language_state = | 1221 translate::LanguageState& language_state = |
| 1222 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); | 1222 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); |
| 1223 language_state.SetTranslateEnabled(true); | 1223 language_state.SetTranslateEnabled(true); |
| 1224 | 1224 |
| 1225 if (!IsMinimized()) { | 1225 if (IsMinimized()) |
| 1226 toolbar_->ShowTranslateBubble(web_contents, step, error_type, | 1226 return ShowTranslateBubbleResult::BROWSER_WINDOW_MINIMIZED; |
| 1227 is_user_gesture); | 1227 |
| 1228 } | 1228 toolbar_->ShowTranslateBubble(web_contents, step, error_type, |
| 1229 is_user_gesture); |
| 1230 return ShowTranslateBubbleResult::SUCCESS; |
| 1229 } | 1231 } |
| 1230 | 1232 |
| 1231 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) | 1233 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) |
| 1232 void BrowserView::ShowOneClickSigninConfirmation( | 1234 void BrowserView::ShowOneClickSigninConfirmation( |
| 1233 const base::string16& email, | 1235 const base::string16& email, |
| 1234 const StartSyncCallback& start_sync_callback) { | 1236 const StartSyncCallback& start_sync_callback) { |
| 1235 std::unique_ptr<OneClickSigninLinksDelegate> delegate( | 1237 std::unique_ptr<OneClickSigninLinksDelegate> delegate( |
| 1236 new OneClickSigninLinksDelegateImpl(browser())); | 1238 new OneClickSigninLinksDelegateImpl(browser())); |
| 1237 OneClickSigninDialogView::ShowDialog(email, std::move(delegate), | 1239 OneClickSigninDialogView::ShowDialog(email, std::move(delegate), |
| 1238 GetNativeWindow(), start_sync_callback); | 1240 GetNativeWindow(), start_sync_callback); |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2590 } | 2592 } |
| 2591 | 2593 |
| 2592 extensions::ActiveTabPermissionGranter* | 2594 extensions::ActiveTabPermissionGranter* |
| 2593 BrowserView::GetActiveTabPermissionGranter() { | 2595 BrowserView::GetActiveTabPermissionGranter() { |
| 2594 content::WebContents* web_contents = GetActiveWebContents(); | 2596 content::WebContents* web_contents = GetActiveWebContents(); |
| 2595 if (!web_contents) | 2597 if (!web_contents) |
| 2596 return nullptr; | 2598 return nullptr; |
| 2597 return extensions::TabHelper::FromWebContents(web_contents) | 2599 return extensions::TabHelper::FromWebContents(web_contents) |
| 2598 ->active_tab_permission_granter(); | 2600 ->active_tab_permission_granter(); |
| 2599 } | 2601 } |
| OLD | NEW |