| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/app/chrome_dll_resource.h" | 16 #include "chrome/app/chrome_dll_resource.h" |
| 17 #include "chrome/browser/accessibility/invert_bubble_views.h" | 17 #include "chrome/browser/accessibility/invert_bubble_views.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" | 19 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_utils.h" | 20 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/debugger/devtools_window.h" | 22 #include "chrome/browser/debugger/devtools_window.h" |
| 23 #include "chrome/browser/extensions/extension_tab_helper.h" | 23 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 24 #include "chrome/browser/instant/instant_controller.h" | 24 #include "chrome/browser/instant/instant_controller.h" |
| 25 #include "chrome/browser/managed_mode.h" |
| 25 #include "chrome/browser/native_window_notification_source.h" | 26 #include "chrome/browser/native_window_notification_source.h" |
| 26 #include "chrome/browser/ntp_background_util.h" | 27 #include "chrome/browser/ntp_background_util.h" |
| 27 #include "chrome/browser/managed_mode.h" | |
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/profiles/avatar_menu_model.h" | 29 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/profiles/profile_info_cache.h" | 31 #include "chrome/browser/profiles/profile_info_cache.h" |
| 32 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/browser/sessions/tab_restore_service.h" | 33 #include "chrome/browser/sessions/tab_restore_service.h" |
| 34 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 34 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 35 #include "chrome/browser/speech/extension_api/tts_extension_api.h" | 35 #include "chrome/browser/speech/extension_api/tts_extension_api.h" |
| 36 #include "chrome/browser/tabs/tab_strip_model.h" | 36 #include "chrome/browser/tabs/tab_strip_model.h" |
| 37 #include "chrome/browser/themes/theme_service.h" | 37 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 ToolbarSizeChanged(false); | 1085 ToolbarSizeChanged(false); |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 bool BrowserView::IsDownloadShelfVisible() const { | 1088 bool BrowserView::IsDownloadShelfVisible() const { |
| 1089 return download_shelf_.get() && download_shelf_->IsShowing(); | 1089 return download_shelf_.get() && download_shelf_->IsShowing(); |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 DownloadShelf* BrowserView::GetDownloadShelf() { | 1092 DownloadShelf* BrowserView::GetDownloadShelf() { |
| 1093 if (!download_shelf_.get()) { | 1093 if (!download_shelf_.get()) { |
| 1094 download_shelf_.reset(new DownloadShelfView(browser_.get(), this)); | 1094 download_shelf_.reset(new DownloadShelfView(browser_.get(), this)); |
| 1095 download_shelf_->set_parent_owned(false); | 1095 download_shelf_->set_not_owned_by_parent(); |
| 1096 } | 1096 } |
| 1097 return download_shelf_.get(); | 1097 return download_shelf_.get(); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 void BrowserView::ConfirmBrowserCloseWithPendingDownloads() { | 1100 void BrowserView::ConfirmBrowserCloseWithPendingDownloads() { |
| 1101 DownloadInProgressDialogView::Show(browser_.get(), GetNativeHandle()); | 1101 DownloadInProgressDialogView::Show(browser_.get(), GetNativeHandle()); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 void BrowserView::ShowCreateWebAppShortcutsDialog( | 1104 void BrowserView::ShowCreateWebAppShortcutsDialog( |
| 1105 TabContentsWrapper* tab_contents) { | 1105 TabContentsWrapper* tab_contents) { |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 gfx::Point origin(-overlap, contents_height - height + overlap); | 1908 gfx::Point origin(-overlap, contents_height - height + overlap); |
| 1909 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height); | 1909 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height); |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) { | 1912 bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) { |
| 1913 views::View* new_bookmark_bar_view = NULL; | 1913 views::View* new_bookmark_bar_view = NULL; |
| 1914 if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) && | 1914 if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) && |
| 1915 contents) { | 1915 contents) { |
| 1916 if (!bookmark_bar_view_.get()) { | 1916 if (!bookmark_bar_view_.get()) { |
| 1917 bookmark_bar_view_.reset(new BookmarkBarView(browser_.get())); | 1917 bookmark_bar_view_.reset(new BookmarkBarView(browser_.get())); |
| 1918 bookmark_bar_view_->set_parent_owned(false); | 1918 bookmark_bar_view_->set_not_owned_by_parent(); |
| 1919 bookmark_bar_view_->set_background( | 1919 bookmark_bar_view_->set_background( |
| 1920 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), | 1920 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), |
| 1921 browser_.get())); | 1921 browser_.get())); |
| 1922 bookmark_bar_view_->SetBookmarkBarState( | 1922 bookmark_bar_view_->SetBookmarkBarState( |
| 1923 browser_->bookmark_bar_state(), | 1923 browser_->bookmark_bar_state(), |
| 1924 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 1924 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
| 1925 } | 1925 } |
| 1926 bookmark_bar_view_->SetPageNavigator(contents->web_contents()); | 1926 bookmark_bar_view_->SetPageNavigator(contents->web_contents()); |
| 1927 new_bookmark_bar_view = bookmark_bar_view_.get(); | 1927 new_bookmark_bar_view = bookmark_bar_view_.get(); |
| 1928 } | 1928 } |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 return; | 2423 return; |
| 2424 | 2424 |
| 2425 PasswordGenerationBubbleView* bubble = | 2425 PasswordGenerationBubbleView* bubble = |
| 2426 new PasswordGenerationBubbleView(bounds, | 2426 new PasswordGenerationBubbleView(bounds, |
| 2427 this, | 2427 this, |
| 2428 web_contents->GetRenderViewHost()); | 2428 web_contents->GetRenderViewHost()); |
| 2429 views::BubbleDelegateView::CreateBubble(bubble); | 2429 views::BubbleDelegateView::CreateBubble(bubble); |
| 2430 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2430 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2431 bubble->Show(); | 2431 bubble->Show(); |
| 2432 } | 2432 } |
| OLD | NEW |