| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 #include "chrome/common/features.h" | 102 #include "chrome/common/features.h" |
| 103 #include "chrome/common/pref_names.h" | 103 #include "chrome/common/pref_names.h" |
| 104 #include "chrome/common/url_constants.h" | 104 #include "chrome/common/url_constants.h" |
| 105 #include "chrome/grit/chromium_strings.h" | 105 #include "chrome/grit/chromium_strings.h" |
| 106 #include "chrome/grit/generated_resources.h" | 106 #include "chrome/grit/generated_resources.h" |
| 107 #include "chrome/grit/locale_settings.h" | 107 #include "chrome/grit/locale_settings.h" |
| 108 #include "chrome/grit/theme_resources.h" | 108 #include "chrome/grit/theme_resources.h" |
| 109 #include "components/app_modal/app_modal_dialog.h" | 109 #include "components/app_modal/app_modal_dialog.h" |
| 110 #include "components/app_modal/app_modal_dialog_queue.h" | 110 #include "components/app_modal/app_modal_dialog_queue.h" |
| 111 #include "components/app_modal/native_app_modal_dialog.h" | 111 #include "components/app_modal/native_app_modal_dialog.h" |
| 112 #include "components/metrics/proto/translate_event.pb.h" |
| 112 #include "components/omnibox/browser/omnibox_popup_model.h" | 113 #include "components/omnibox/browser/omnibox_popup_model.h" |
| 113 #include "components/omnibox/browser/omnibox_popup_view.h" | 114 #include "components/omnibox/browser/omnibox_popup_view.h" |
| 114 #include "components/omnibox/browser/omnibox_view.h" | 115 #include "components/omnibox/browser/omnibox_view.h" |
| 115 #include "components/prefs/pref_service.h" | 116 #include "components/prefs/pref_service.h" |
| 116 #include "components/sessions/core/tab_restore_service.h" | 117 #include "components/sessions/core/tab_restore_service.h" |
| 117 #include "components/signin/core/common/profile_management_switches.h" | 118 #include "components/signin/core/common/profile_management_switches.h" |
| 118 #include "components/translate/core/browser/language_state.h" | 119 #include "components/translate/core/browser/language_state.h" |
| 119 #include "content/public/browser/download_manager.h" | 120 #include "content/public/browser/download_manager.h" |
| 120 #include "content/public/browser/notification_service.h" | 121 #include "content/public/browser/notification_service.h" |
| 121 #include "content/public/browser/render_frame_host.h" | 122 #include "content/public/browser/render_frame_host.h" |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 } | 1200 } |
| 1200 | 1201 |
| 1201 autofill::SaveCardBubbleView* BrowserView::ShowSaveCreditCardBubble( | 1202 autofill::SaveCardBubbleView* BrowserView::ShowSaveCreditCardBubble( |
| 1202 content::WebContents* web_contents, | 1203 content::WebContents* web_contents, |
| 1203 autofill::SaveCardBubbleController* controller, | 1204 autofill::SaveCardBubbleController* controller, |
| 1204 bool is_user_gesture) { | 1205 bool is_user_gesture) { |
| 1205 return toolbar_->ShowSaveCreditCardBubble(web_contents, controller, | 1206 return toolbar_->ShowSaveCreditCardBubble(web_contents, controller, |
| 1206 is_user_gesture); | 1207 is_user_gesture); |
| 1207 } | 1208 } |
| 1208 | 1209 |
| 1209 void BrowserView::ShowTranslateBubble( | 1210 ShowTranslateBubbleResult BrowserView::ShowTranslateBubble( |
| 1210 content::WebContents* web_contents, | 1211 content::WebContents* web_contents, |
| 1211 translate::TranslateStep step, | 1212 translate::TranslateStep step, |
| 1212 translate::TranslateErrors::Type error_type, | 1213 translate::TranslateErrors::Type error_type, |
| 1213 bool is_user_gesture) { | 1214 bool is_user_gesture) { |
| 1214 if (contents_web_view_->HasFocus() && | 1215 if (contents_web_view_->HasFocus() && |
| 1215 !GetLocationBarView()->IsMouseHovered()) { | 1216 !GetLocationBarView()->IsMouseHovered()) { |
| 1216 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); | 1217 content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); |
| 1217 if (rvh->IsFocusedElementEditable()) | 1218 if (rvh->IsFocusedElementEditable()) |
| 1218 return; | 1219 return ShowTranslateBubbleResult::EDITABLE_FIELD_IS_ACTIVE; |
| 1219 } | 1220 } |
| 1220 | 1221 |
| 1221 translate::LanguageState& language_state = | 1222 translate::LanguageState& language_state = |
| 1222 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); | 1223 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); |
| 1223 language_state.SetTranslateEnabled(true); | 1224 language_state.SetTranslateEnabled(true); |
| 1224 | 1225 |
| 1225 if (!IsMinimized()) { | 1226 if (IsMinimized()) |
| 1226 toolbar_->ShowTranslateBubble(web_contents, step, error_type, | 1227 return ShowTranslateBubbleResult::BROWSER_WINDOW_MINIMIZED; |
| 1227 is_user_gesture); | 1228 |
| 1228 } | 1229 toolbar_->ShowTranslateBubble(web_contents, step, error_type, |
| 1230 is_user_gesture); |
| 1231 return ShowTranslateBubbleResult::SUCCESS; |
| 1229 } | 1232 } |
| 1230 | 1233 |
| 1231 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) | 1234 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) |
| 1232 void BrowserView::ShowOneClickSigninConfirmation( | 1235 void BrowserView::ShowOneClickSigninConfirmation( |
| 1233 const base::string16& email, | 1236 const base::string16& email, |
| 1234 const StartSyncCallback& start_sync_callback) { | 1237 const StartSyncCallback& start_sync_callback) { |
| 1235 std::unique_ptr<OneClickSigninLinksDelegate> delegate( | 1238 std::unique_ptr<OneClickSigninLinksDelegate> delegate( |
| 1236 new OneClickSigninLinksDelegateImpl(browser())); | 1239 new OneClickSigninLinksDelegateImpl(browser())); |
| 1237 OneClickSigninDialogView::ShowDialog(email, std::move(delegate), | 1240 OneClickSigninDialogView::ShowDialog(email, std::move(delegate), |
| 1238 GetNativeWindow(), start_sync_callback); | 1241 GetNativeWindow(), start_sync_callback); |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 } | 2592 } |
| 2590 | 2593 |
| 2591 extensions::ActiveTabPermissionGranter* | 2594 extensions::ActiveTabPermissionGranter* |
| 2592 BrowserView::GetActiveTabPermissionGranter() { | 2595 BrowserView::GetActiveTabPermissionGranter() { |
| 2593 content::WebContents* web_contents = GetActiveWebContents(); | 2596 content::WebContents* web_contents = GetActiveWebContents(); |
| 2594 if (!web_contents) | 2597 if (!web_contents) |
| 2595 return nullptr; | 2598 return nullptr; |
| 2596 return extensions::TabHelper::FromWebContents(web_contents) | 2599 return extensions::TabHelper::FromWebContents(web_contents) |
| 2597 ->active_tab_permission_granter(); | 2600 ->active_tab_permission_granter(); |
| 2598 } | 2601 } |
| OLD | NEW |