| 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" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/app/chrome_dll_resource.h" | 18 #include "chrome/app/chrome_dll_resource.h" |
| 18 #include "chrome/browser/app_mode/app_mode_utils.h" | 19 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 19 #include "chrome/browser/bookmarks/bookmark_utils.h" | 20 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "chrome/browser/ui/views/browser_dialogs.h" | 65 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 65 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" | 66 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" |
| 66 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 67 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 67 #include "chrome/browser/ui/views/frame/browser_view_layout.h" | 68 #include "chrome/browser/ui/views/frame/browser_view_layout.h" |
| 68 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 69 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
| 69 #include "chrome/browser/ui/views/frame/contents_container.h" | 70 #include "chrome/browser/ui/views/frame/contents_container.h" |
| 70 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 71 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 71 #include "chrome/browser/ui/views/frame/top_container_view.h" | 72 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 72 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" | 73 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
| 73 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 74 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 75 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 74 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 76 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 75 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 77 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 76 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 78 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
| 77 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 79 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
| 78 #include "chrome/browser/ui/views/status_bubble_views.h" | 80 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 79 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 81 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 80 #include "chrome/browser/ui/views/tabs/tab.h" | 82 #include "chrome/browser/ui/views/tabs/tab.h" |
| 81 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 83 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 82 #include "chrome/browser/ui/views/toolbar_view.h" | 84 #include "chrome/browser/ui/views/toolbar_view.h" |
| 83 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 85 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 #include "ui/base/accelerators/accelerator.h" | 107 #include "ui/base/accelerators/accelerator.h" |
| 106 #include "ui/base/accessibility/accessible_view_state.h" | 108 #include "ui/base/accessibility/accessible_view_state.h" |
| 107 #include "ui/base/events/event_utils.h" | 109 #include "ui/base/events/event_utils.h" |
| 108 #include "ui/base/hit_test.h" | 110 #include "ui/base/hit_test.h" |
| 109 #include "ui/base/l10n/l10n_util.h" | 111 #include "ui/base/l10n/l10n_util.h" |
| 110 #include "ui/base/resource/resource_bundle.h" | 112 #include "ui/base/resource/resource_bundle.h" |
| 111 #include "ui/base/theme_provider.h" | 113 #include "ui/base/theme_provider.h" |
| 112 #include "ui/gfx/canvas.h" | 114 #include "ui/gfx/canvas.h" |
| 113 #include "ui/gfx/color_utils.h" | 115 #include "ui/gfx/color_utils.h" |
| 114 #include "ui/gfx/sys_color_change_listener.h" | 116 #include "ui/gfx/sys_color_change_listener.h" |
| 117 #include "ui/views/controls/button/menu_button.h" |
| 115 #include "ui/views/controls/single_split_view.h" | 118 #include "ui/views/controls/single_split_view.h" |
| 116 #include "ui/views/controls/textfield/textfield.h" | 119 #include "ui/views/controls/textfield/textfield.h" |
| 117 #include "ui/views/controls/webview/webview.h" | 120 #include "ui/views/controls/webview/webview.h" |
| 118 #include "ui/views/focus/external_focus_tracker.h" | 121 #include "ui/views/focus/external_focus_tracker.h" |
| 119 #include "ui/views/focus/view_storage.h" | 122 #include "ui/views/focus/view_storage.h" |
| 120 #include "ui/views/layout/grid_layout.h" | 123 #include "ui/views/layout/grid_layout.h" |
| 121 #include "ui/views/widget/native_widget.h" | 124 #include "ui/views/widget/native_widget.h" |
| 122 #include "ui/views/widget/root_view.h" | 125 #include "ui/views/widget/root_view.h" |
| 123 #include "ui/views/widget/widget.h" | 126 #include "ui/views/widget/widget.h" |
| 124 #include "ui/views/window/dialog_delegate.h" | 127 #include "ui/views/window/dialog_delegate.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 142 #include "ui/views/widget/native_widget_win.h" | 145 #include "ui/views/widget/native_widget_win.h" |
| 143 #include "ui/views/win/scoped_fullscreen_visibility.h" | 146 #include "ui/views/win/scoped_fullscreen_visibility.h" |
| 144 #endif | 147 #endif |
| 145 | 148 |
| 146 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
| 147 #include "base/win/windows_version.h" | 150 #include "base/win/windows_version.h" |
| 148 #include "win8/util/win8_util.h" | 151 #include "win8/util/win8_util.h" |
| 149 #endif | 152 #endif |
| 150 | 153 |
| 151 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 154 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 155 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" |
| 156 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" |
| 152 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" | 157 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
| 153 #endif | 158 #endif |
| 154 | 159 |
| 155 using base::TimeDelta; | 160 using base::TimeDelta; |
| 156 using content::NativeWebKeyboardEvent; | 161 using content::NativeWebKeyboardEvent; |
| 157 using content::SSLStatus; | 162 using content::SSLStatus; |
| 158 using content::UserMetricsAction; | 163 using content::UserMetricsAction; |
| 159 using content::WebContents; | 164 using content::WebContents; |
| 160 using views::ColumnSet; | 165 using views::ColumnSet; |
| 161 using views::GridLayout; | 166 using views::GridLayout; |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 void BrowserView::ShowBookmarkPrompt() { | 1108 void BrowserView::ShowBookmarkPrompt() { |
| 1104 GetLocationBarView()->ShowBookmarkPrompt(); | 1109 GetLocationBarView()->ShowBookmarkPrompt(); |
| 1105 } | 1110 } |
| 1106 | 1111 |
| 1107 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 1112 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 1108 void BrowserView::ShowOneClickSigninBubble( | 1113 void BrowserView::ShowOneClickSigninBubble( |
| 1109 OneClickSigninBubbleType type, | 1114 OneClickSigninBubbleType type, |
| 1110 const string16& email, | 1115 const string16& email, |
| 1111 const string16& error_message, | 1116 const string16& error_message, |
| 1112 const StartSyncCallback& start_sync_callback) { | 1117 const StartSyncCallback& start_sync_callback) { |
| 1113 OneClickSigninBubbleView::ShowBubble(type, email, error_message, | 1118 scoped_ptr<OneClickSigninBubbleDelegate> delegate; |
| 1114 toolbar_, start_sync_callback); | 1119 delegate.reset(new OneClickSigninBubbleLinksDelegate(browser())); |
| 1120 |
| 1121 views::View* anchor_view; |
| 1122 if (type == BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE) |
| 1123 anchor_view = toolbar_->app_menu(); |
| 1124 else |
| 1125 anchor_view = toolbar_->location_bar(); |
| 1126 |
| 1127 OneClickSigninBubbleView::ShowBubble(type, |
| 1128 email, |
| 1129 error_message, |
| 1130 delegate.Pass(), |
| 1131 anchor_view, |
| 1132 start_sync_callback); |
| 1115 } | 1133 } |
| 1116 #endif | 1134 #endif |
| 1117 | 1135 |
| 1118 void BrowserView::SetDownloadShelfVisible(bool visible) { | 1136 void BrowserView::SetDownloadShelfVisible(bool visible) { |
| 1119 // This can be called from the superclass destructor, when it destroys our | 1137 // This can be called from the superclass destructor, when it destroys our |
| 1120 // child views. At that point, browser_ is already gone. | 1138 // child views. At that point, browser_ is already gone. |
| 1121 if (browser_ == NULL) | 1139 if (browser_ == NULL) |
| 1122 return; | 1140 return; |
| 1123 | 1141 |
| 1124 if (visible && IsDownloadShelfVisible() != visible) { | 1142 if (visible && IsDownloadShelfVisible() != visible) { |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2669 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2687 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2670 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2688 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2671 LocationBarView::kIconInternalPadding + 1); | 2689 LocationBarView::kIconInternalPadding + 1); |
| 2672 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2690 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2673 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2691 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2674 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2692 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2675 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2693 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2676 } | 2694 } |
| 2677 return top_arrow_height; | 2695 return top_arrow_height; |
| 2678 } | 2696 } |
| OLD | NEW |