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/browser.h" | 43 #include "chrome/browser/ui/browser.h" |
| 43 #include "chrome/browser/ui/browser_command_controller.h" | 44 #include "chrome/browser/ui/browser_command_controller.h" |
| 44 #include "chrome/browser/ui/browser_commands.h" | 45 #include "chrome/browser/ui/browser_commands.h" |
| 45 #include "chrome/browser/ui/browser_dialogs.h" | 46 #include "chrome/browser/ui/browser_dialogs.h" |
| 46 #include "chrome/browser/ui/browser_finder.h" | 47 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 76 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 77 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 77 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 78 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 78 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 79 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 79 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 80 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
| 80 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 81 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
| 81 #include "chrome/browser/ui/views/status_bubble_views.h" | 82 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 82 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 83 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 83 #include "chrome/browser/ui/views/tabs/tab.h" | 84 #include "chrome/browser/ui/views/tabs/tab.h" |
| 84 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 85 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 85 #include "chrome/browser/ui/views/toolbar_view.h" | 86 #include "chrome/browser/ui/views/toolbar_view.h" |
| 87 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | |
| 86 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 88 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| 87 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " | 89 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
| 88 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 90 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 89 #include "chrome/common/chrome_switches.h" | 91 #include "chrome/common/chrome_switches.h" |
| 90 #include "chrome/common/pref_names.h" | 92 #include "chrome/common/pref_names.h" |
| 91 #include "chrome/common/url_constants.h" | 93 #include "chrome/common/url_constants.h" |
| 92 #include "content/public/browser/download_manager.h" | 94 #include "content/public/browser/download_manager.h" |
| 93 #include "content/public/browser/native_web_keyboard_event.h" | 95 #include "content/public/browser/native_web_keyboard_event.h" |
| 94 #include "content/public/browser/notification_service.h" | 96 #include "content/public/browser/notification_service.h" |
| 95 #include "content/public/browser/render_view_host.h" | 97 #include "content/public/browser/render_view_host.h" |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1172 delegate.Pass(), | 1174 delegate.Pass(), |
| 1173 browser_->profile(), | 1175 browser_->profile(), |
| 1174 url, | 1176 url, |
| 1175 !already_bookmarked); | 1177 !already_bookmarked); |
| 1176 } | 1178 } |
| 1177 | 1179 |
| 1178 void BrowserView::ShowBookmarkPrompt() { | 1180 void BrowserView::ShowBookmarkPrompt() { |
| 1179 GetLocationBarView()->ShowBookmarkPrompt(); | 1181 GetLocationBarView()->ShowBookmarkPrompt(); |
| 1180 } | 1182 } |
| 1181 | 1183 |
| 1184 void BrowserView::ShowTranslateBubble( | |
| 1185 content::WebContents* web_contents, | |
| 1186 TranslateBubbleModel::ViewState view_state) { | |
| 1187 if (web_contents != browser_->tab_strip_model()->GetActiveWebContents()) | |
|
sky
2013/10/23 14:43:29
Don't you have this check where ShowTranslateBubbl
hajimehoshi
2013/10/24 11:31:14
Done.
| |
| 1188 return; | |
| 1189 | |
| 1190 TranslateTabHelper* translate_tab_helper = | |
| 1191 TranslateTabHelper::FromWebContents(web_contents); | |
| 1192 LanguageState& language_state = translate_tab_helper->language_state(); | |
| 1193 language_state.SetTranslateEnabled(true); | |
| 1194 | |
| 1195 TranslateBubbleView::ShowBubble(GetToolbarView()->GetTranslateBubbleAnchor(), | |
| 1196 web_contents, view_state, browser_.get()); | |
| 1197 } | |
| 1198 | |
| 1182 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 1199 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 1183 void BrowserView::ShowOneClickSigninBubble( | 1200 void BrowserView::ShowOneClickSigninBubble( |
| 1184 OneClickSigninBubbleType type, | 1201 OneClickSigninBubbleType type, |
| 1185 const string16& email, | 1202 const string16& email, |
| 1186 const string16& error_message, | 1203 const string16& error_message, |
| 1187 const StartSyncCallback& start_sync_callback) { | 1204 const StartSyncCallback& start_sync_callback) { |
| 1188 scoped_ptr<OneClickSigninBubbleDelegate> delegate; | 1205 scoped_ptr<OneClickSigninBubbleDelegate> delegate; |
| 1189 delegate.reset(new OneClickSigninBubbleLinksDelegate(browser())); | 1206 delegate.reset(new OneClickSigninBubbleLinksDelegate(browser())); |
| 1190 | 1207 |
| 1191 views::View* anchor_view; | 1208 views::View* anchor_view; |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2687 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2704 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2688 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2705 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2689 LocationBarView::kIconInternalPadding + 1); | 2706 LocationBarView::kIconInternalPadding + 1); |
| 2690 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2707 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2691 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2708 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2692 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2709 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2693 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2710 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2694 } | 2711 } |
| 2695 return top_arrow_height; | 2712 return top_arrow_height; |
| 2696 } | 2713 } |
| OLD | NEW |