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 16 matching lines...) Expand all Loading... | |
| 27 #include "chrome/browser/profiles/avatar_menu.h" | 27 #include "chrome/browser/profiles/avatar_menu.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/profiles/profile_info_cache.h" | 29 #include "chrome/browser/profiles/profile_info_cache.h" |
| 30 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 31 #include "chrome/browser/search/search.h" | 31 #include "chrome/browser/search/search.h" |
| 32 #include "chrome/browser/sessions/tab_restore_service.h" | 32 #include "chrome/browser/sessions/tab_restore_service.h" |
| 33 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 33 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 34 #include "chrome/browser/speech/tts_controller.h" | 34 #include "chrome/browser/speech/tts_controller.h" |
| 35 #include "chrome/browser/themes/theme_properties.h" | 35 #include "chrome/browser/themes/theme_properties.h" |
| 36 #include "chrome/browser/themes/theme_service_factory.h" | 36 #include "chrome/browser/themes/theme_service_factory.h" |
| 37 #include "chrome/browser/translate/translate_tab_helper.h" | |
| 37 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 38 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 38 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 39 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
| 39 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 40 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| 40 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" | 41 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" |
| 41 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" | 42 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" |
| 42 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 43 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 43 #include "chrome/browser/ui/browser.h" | 44 #include "chrome/browser/ui/browser.h" |
| 44 #include "chrome/browser/ui/browser_command_controller.h" | 45 #include "chrome/browser/ui/browser_command_controller.h" |
| 45 #include "chrome/browser/ui/browser_commands.h" | 46 #include "chrome/browser/ui/browser_commands.h" |
| 46 #include "chrome/browser/ui/browser_dialogs.h" | 47 #include "chrome/browser/ui/browser_dialogs.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 77 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 78 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 78 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 79 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 79 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 80 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 80 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 81 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
| 81 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 82 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
| 82 #include "chrome/browser/ui/views/status_bubble_views.h" | 83 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 83 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 84 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 84 #include "chrome/browser/ui/views/tabs/tab.h" | 85 #include "chrome/browser/ui/views/tabs/tab.h" |
| 85 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 86 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 86 #include "chrome/browser/ui/views/toolbar_view.h" | 87 #include "chrome/browser/ui/views/toolbar_view.h" |
| 88 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | |
| 87 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 89 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| 88 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " | 90 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
| 89 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 91 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 90 #include "chrome/common/chrome_switches.h" | 92 #include "chrome/common/chrome_switches.h" |
| 91 #include "chrome/common/pref_names.h" | 93 #include "chrome/common/pref_names.h" |
| 92 #include "chrome/common/url_constants.h" | 94 #include "chrome/common/url_constants.h" |
| 93 #include "content/public/browser/download_manager.h" | 95 #include "content/public/browser/download_manager.h" |
| 94 #include "content/public/browser/native_web_keyboard_event.h" | 96 #include "content/public/browser/native_web_keyboard_event.h" |
| 95 #include "content/public/browser/notification_service.h" | 97 #include "content/public/browser/notification_service.h" |
| 96 #include "content/public/browser/render_view_host.h" | 98 #include "content/public/browser/render_view_host.h" |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1148 delegate.Pass(), | 1150 delegate.Pass(), |
| 1149 browser_->profile(), | 1151 browser_->profile(), |
| 1150 url, | 1152 url, |
| 1151 !already_bookmarked); | 1153 !already_bookmarked); |
| 1152 } | 1154 } |
| 1153 | 1155 |
| 1154 void BrowserView::ShowBookmarkPrompt() { | 1156 void BrowserView::ShowBookmarkPrompt() { |
| 1155 GetLocationBarView()->ShowBookmarkPrompt(); | 1157 GetLocationBarView()->ShowBookmarkPrompt(); |
| 1156 } | 1158 } |
| 1157 | 1159 |
| 1160 void BrowserView::ShowTranslateBubble(content::WebContents* web_contents, | |
| 1161 TranslateBubble::Type type) { | |
| 1162 if (web_contents != browser_->tab_strip_model()->GetActiveWebContents()) | |
| 1163 return; | |
| 1164 | |
| 1165 TranslateTabHelper* translate_tab_helper = | |
| 1166 TranslateTabHelper::FromWebContents(web_contents); | |
| 1167 LanguageState& language_state = translate_tab_helper->language_state(); | |
| 1168 language_state.SetIsTranslateSuggested(true); | |
|
Takashi Toyoshima
2013/10/08 14:54:09
Do you really need to set language state here?
Als
hajimehoshi
2013/10/10 11:07:10
As we discussed offline, this calling is needed to
| |
| 1169 | |
| 1170 TranslateBubbleView::ShowBubble(GetToolbarView()->GetTranslateBubbleAnchor(), | |
| 1171 web_contents, type); | |
| 1172 } | |
| 1173 | |
| 1158 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 1174 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 1159 void BrowserView::ShowOneClickSigninBubble( | 1175 void BrowserView::ShowOneClickSigninBubble( |
| 1160 OneClickSigninBubbleType type, | 1176 OneClickSigninBubbleType type, |
| 1161 const string16& email, | 1177 const string16& email, |
| 1162 const string16& error_message, | 1178 const string16& error_message, |
| 1163 const StartSyncCallback& start_sync_callback) { | 1179 const StartSyncCallback& start_sync_callback) { |
| 1164 scoped_ptr<OneClickSigninBubbleDelegate> delegate; | 1180 scoped_ptr<OneClickSigninBubbleDelegate> delegate; |
| 1165 delegate.reset(new OneClickSigninBubbleLinksDelegate(browser())); | 1181 delegate.reset(new OneClickSigninBubbleLinksDelegate(browser())); |
| 1166 | 1182 |
| 1167 views::View* anchor_view; | 1183 views::View* anchor_view; |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2678 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2694 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2679 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2695 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2680 LocationBarView::kIconInternalPadding + 1); | 2696 LocationBarView::kIconInternalPadding + 1); |
| 2681 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2697 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2682 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2698 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2683 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2699 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2684 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2700 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2685 } | 2701 } |
| 2686 return top_arrow_height; | 2702 return top_arrow_height; |
| 2687 } | 2703 } |
| OLD | NEW |