OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/instant/instant_controller.h" | 29 #include "chrome/browser/instant/instant_controller.h" |
30 #include "chrome/browser/native_window_notification_source.h" | 30 #include "chrome/browser/native_window_notification_source.h" |
31 #include "chrome/browser/ntp_background_util.h" | 31 #include "chrome/browser/ntp_background_util.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
33 #include "chrome/browser/profiles/avatar_menu_model.h" | 33 #include "chrome/browser/profiles/avatar_menu_model.h" |
34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/profiles/profile_info_cache.h" | 35 #include "chrome/browser/profiles/profile_info_cache.h" |
36 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
37 #include "chrome/browser/sessions/tab_restore_service.h" | 37 #include "chrome/browser/sessions/tab_restore_service.h" |
38 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 38 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
39 #include "chrome/browser/sidebar/sidebar_container.h" | |
40 #include "chrome/browser/sidebar/sidebar_manager.h" | |
41 #include "chrome/browser/tabs/tab_strip_model.h" | 39 #include "chrome/browser/tabs/tab_strip_model.h" |
42 #include "chrome/browser/themes/theme_service.h" | 40 #include "chrome/browser/themes/theme_service.h" |
43 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 41 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
44 #include "chrome/browser/ui/browser.h" | 42 #include "chrome/browser/ui/browser.h" |
45 #include "chrome/browser/ui/browser_dialogs.h" | 43 #include "chrome/browser/ui/browser_dialogs.h" |
46 #include "chrome/browser/ui/browser_list.h" | 44 #include "chrome/browser/ui/browser_list.h" |
47 #include "chrome/browser/ui/dialog_style.h" | 45 #include "chrome/browser/ui/dialog_style.h" |
48 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 46 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
49 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 47 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
50 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 48 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 BrowserView::BrowserView(Browser* browser) | 313 BrowserView::BrowserView(Browser* browser) |
316 : views::ClientView(NULL, NULL), | 314 : views::ClientView(NULL, NULL), |
317 last_focused_view_storage_id_( | 315 last_focused_view_storage_id_( |
318 views::ViewStorage::GetInstance()->CreateStorageID()), | 316 views::ViewStorage::GetInstance()->CreateStorageID()), |
319 frame_(NULL), | 317 frame_(NULL), |
320 browser_(browser), | 318 browser_(browser), |
321 active_bookmark_bar_(NULL), | 319 active_bookmark_bar_(NULL), |
322 tabstrip_(NULL), | 320 tabstrip_(NULL), |
323 toolbar_(NULL), | 321 toolbar_(NULL), |
324 infobar_container_(NULL), | 322 infobar_container_(NULL), |
325 sidebar_container_(NULL), | |
326 sidebar_split_(NULL), | |
327 contents_container_(NULL), | 323 contents_container_(NULL), |
328 devtools_container_(NULL), | 324 devtools_container_(NULL), |
329 preview_container_(NULL), | 325 preview_container_(NULL), |
330 contents_(NULL), | 326 contents_(NULL), |
331 contents_split_(NULL), | 327 contents_split_(NULL), |
332 initialized_(false), | 328 initialized_(false), |
333 ignore_layout_(true), | 329 ignore_layout_(true), |
334 #if defined(OS_WIN) && !defined(USE_AURA) | 330 #if defined(OS_WIN) && !defined(USE_AURA) |
335 hung_window_detector_(&hung_plugin_action_), | 331 hung_window_detector_(&hung_plugin_action_), |
336 ticker_(0), | 332 ticker_(0), |
337 #endif | 333 #endif |
338 force_location_bar_focus_(false) { | 334 force_location_bar_focus_(false) { |
339 browser_->tabstrip_model()->AddObserver(this); | 335 browser_->tabstrip_model()->AddObserver(this); |
340 | |
341 registrar_.Add( | |
342 this, | |
343 chrome::NOTIFICATION_SIDEBAR_CHANGED, | |
344 content::Source<SidebarManager>(SidebarManager::GetInstance())); | |
345 } | 336 } |
346 | 337 |
347 BrowserView::~BrowserView() { | 338 BrowserView::~BrowserView() { |
348 #if defined(USE_AURA) | 339 #if defined(USE_AURA) |
349 // Destroy LauncherIconUpdater early on as it listens to the TabstripModel, | 340 // Destroy LauncherIconUpdater early on as it listens to the TabstripModel, |
350 // which is destroyed by the browser. | 341 // which is destroyed by the browser. |
351 icon_updater_.reset(); | 342 icon_updater_.reset(); |
352 #endif | 343 #endif |
353 | 344 |
354 browser_->tabstrip_model()->RemoveObserver(this); | 345 browser_->tabstrip_model()->RemoveObserver(this); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage( | 429 gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage( |
439 const gfx::Point& point) const { | 430 const gfx::Point& point) const { |
440 // The background image starts tiling horizontally at the window left edge and | 431 // The background image starts tiling horizontally at the window left edge and |
441 // vertically at the top edge of the horizontal tab strip (or where it would | 432 // vertically at the top edge of the horizontal tab strip (or where it would |
442 // be). We expect our parent's origin to be the window origin. | 433 // be). We expect our parent's origin to be the window origin. |
443 gfx::Point window_point(point.Add(GetMirroredPosition())); | 434 gfx::Point window_point(point.Add(GetMirroredPosition())); |
444 window_point.Offset(0, -frame_->GetHorizontalTabStripVerticalOffset(false)); | 435 window_point.Offset(0, -frame_->GetHorizontalTabStripVerticalOffset(false)); |
445 return window_point; | 436 return window_point; |
446 } | 437 } |
447 | 438 |
448 int BrowserView::GetSidebarWidth() const { | |
449 if (!sidebar_container_ || !sidebar_container_->visible()) | |
450 return 0; | |
451 return sidebar_split_->divider_offset(); | |
452 } | |
453 | |
454 bool BrowserView::IsTabStripVisible() const { | 439 bool BrowserView::IsTabStripVisible() const { |
455 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); | 440 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); |
456 } | 441 } |
457 | 442 |
458 bool BrowserView::IsOffTheRecord() const { | 443 bool BrowserView::IsOffTheRecord() const { |
459 return browser_->profile()->IsOffTheRecord(); | 444 return browser_->profile()->IsOffTheRecord(); |
460 } | 445 } |
461 | 446 |
462 bool BrowserView::IsGuestSession() const { | 447 bool BrowserView::IsGuestSession() const { |
463 return browser_->profile()->IsGuestSession(); | 448 return browser_->profile()->IsGuestSession(); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 // with NULL to represent the tab contents getting focus. If one of these | 938 // with NULL to represent the tab contents getting focus. If one of these |
954 // is currently invisible or has no focusable children it will be | 939 // is currently invisible or has no focusable children it will be |
955 // automatically skipped. | 940 // automatically skipped. |
956 std::vector<views::AccessiblePaneView*> accessible_panes; | 941 std::vector<views::AccessiblePaneView*> accessible_panes; |
957 GetAccessiblePanes(&accessible_panes); | 942 GetAccessiblePanes(&accessible_panes); |
958 int pane_count = static_cast<int>(accessible_panes.size()); | 943 int pane_count = static_cast<int>(accessible_panes.size()); |
959 | 944 |
960 std::vector<views::View*> accessible_views( | 945 std::vector<views::View*> accessible_views( |
961 accessible_panes.begin(), accessible_panes.end()); | 946 accessible_panes.begin(), accessible_panes.end()); |
962 accessible_views.push_back(GetTabContentsContainerView()); | 947 accessible_views.push_back(GetTabContentsContainerView()); |
963 if (sidebar_container_ && sidebar_container_->visible()) | |
964 accessible_views.push_back(GetSidebarContainerView()); | |
965 if (devtools_container_->visible()) | 948 if (devtools_container_->visible()) |
966 accessible_views.push_back(devtools_container_->GetFocusView()); | 949 accessible_views.push_back(devtools_container_->GetFocusView()); |
967 int count = static_cast<int>(accessible_views.size()); | 950 int count = static_cast<int>(accessible_views.size()); |
968 | 951 |
969 // Figure out which view (if any) currently has the focus. | 952 // Figure out which view (if any) currently has the focus. |
970 const views::View* focused_view = GetFocusManager()->GetFocusedView(); | 953 const views::View* focused_view = GetFocusManager()->GetFocusedView(); |
971 int index = -1; | 954 int index = -1; |
972 if (focused_view) { | 955 if (focused_view) { |
973 for (int i = 0; i < count; ++i) { | 956 for (int i = 0; i < count; ++i) { |
974 if (accessible_views[i] == focused_view || | 957 if (accessible_views[i] == focused_view || |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 } | 1357 } |
1375 | 1358 |
1376 LocationBarView* BrowserView::GetLocationBarView() const { | 1359 LocationBarView* BrowserView::GetLocationBarView() const { |
1377 return toolbar_ ? toolbar_->location_bar() : NULL; | 1360 return toolbar_ ? toolbar_->location_bar() : NULL; |
1378 } | 1361 } |
1379 | 1362 |
1380 views::View* BrowserView::GetTabContentsContainerView() const { | 1363 views::View* BrowserView::GetTabContentsContainerView() const { |
1381 return contents_container_->GetFocusView(); | 1364 return contents_container_->GetFocusView(); |
1382 } | 1365 } |
1383 | 1366 |
1384 views::View* BrowserView::GetSidebarContainerView() const { | |
1385 if (!sidebar_container_) | |
1386 return NULL; | |
1387 return sidebar_container_->GetFocusView(); | |
1388 } | |
1389 | |
1390 ToolbarView* BrowserView::GetToolbarView() const { | 1367 ToolbarView* BrowserView::GetToolbarView() const { |
1391 return toolbar_; | 1368 return toolbar_; |
1392 } | 1369 } |
1393 | 1370 |
1394 /////////////////////////////////////////////////////////////////////////////// | 1371 /////////////////////////////////////////////////////////////////////////////// |
1395 // BrowserView, content::NotificationObserver implementation: | |
1396 | |
1397 void BrowserView::Observe(int type, | |
1398 const content::NotificationSource& source, | |
1399 const content::NotificationDetails& details) { | |
1400 switch (type) { | |
1401 case chrome::NOTIFICATION_SIDEBAR_CHANGED: | |
1402 if (content::Details<SidebarContainer>(details)->tab_contents() == | |
1403 browser_->GetSelectedTabContents()) { | |
1404 UpdateSidebar(); | |
1405 } | |
1406 break; | |
1407 | |
1408 default: | |
1409 NOTREACHED() << "Got a notification we didn't register for!"; | |
1410 break; | |
1411 } | |
1412 } | |
1413 | |
1414 /////////////////////////////////////////////////////////////////////////////// | |
1415 // BrowserView, TabStripModelObserver implementation: | 1372 // BrowserView, TabStripModelObserver implementation: |
1416 | 1373 |
1417 void BrowserView::TabDetachedAt(TabContentsWrapper* contents, int index) { | 1374 void BrowserView::TabDetachedAt(TabContentsWrapper* contents, int index) { |
1418 // We use index here rather than comparing |contents| because by this time | 1375 // We use index here rather than comparing |contents| because by this time |
1419 // the model has already removed |contents| from its list, so | 1376 // the model has already removed |contents| from its list, so |
1420 // browser_->GetSelectedTabContents() will return NULL or something else. | 1377 // browser_->GetSelectedTabContents() will return NULL or something else. |
1421 if (index == browser_->tabstrip_model()->active_index()) { | 1378 if (index == browser_->tabstrip_model()->active_index()) { |
1422 // We need to reset the current tab contents to NULL before it gets | 1379 // We need to reset the current tab contents to NULL before it gets |
1423 // freed. This is because the focus manager performs some operations | 1380 // freed. This is because the focus manager performs some operations |
1424 // on the selected TabContents when it is removed. | 1381 // on the selected TabContents when it is removed. |
1425 contents_container_->ChangeTabContents(NULL); | 1382 contents_container_->ChangeTabContents(NULL); |
1426 infobar_container_->ChangeTabContents(NULL); | 1383 infobar_container_->ChangeTabContents(NULL); |
1427 UpdateSidebarForContents(NULL); | |
1428 UpdateDevToolsForContents(NULL); | 1384 UpdateDevToolsForContents(NULL); |
1429 } | 1385 } |
1430 } | 1386 } |
1431 | 1387 |
1432 void BrowserView::TabDeactivated(TabContentsWrapper* contents) { | 1388 void BrowserView::TabDeactivated(TabContentsWrapper* contents) { |
1433 // We do not store the focus when closing the tab to work-around bug 4633. | 1389 // We do not store the focus when closing the tab to work-around bug 4633. |
1434 // Some reports seem to show that the focus manager and/or focused view can | 1390 // Some reports seem to show that the focus manager and/or focused view can |
1435 // be garbage at that point, it is not clear why. | 1391 // be garbage at that point, it is not clear why. |
1436 if (!contents->tab_contents()->is_being_destroyed()) | 1392 if (!contents->tab_contents()->is_being_destroyed()) |
1437 contents->tab_contents()->GetView()->StoreFocus(); | 1393 contents->tab_contents()->GetView()->StoreFocus(); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 | 1874 |
1919 infobar_container_ = new InfoBarContainerView(this); | 1875 infobar_container_ = new InfoBarContainerView(this); |
1920 AddChildView(infobar_container_); | 1876 AddChildView(infobar_container_); |
1921 | 1877 |
1922 contents_container_ = new TabContentsContainer; | 1878 contents_container_ = new TabContentsContainer; |
1923 contents_ = new ContentsContainer(contents_container_); | 1879 contents_ = new ContentsContainer(contents_container_); |
1924 | 1880 |
1925 SkColor bg_color = GetWidget()->GetThemeProvider()-> | 1881 SkColor bg_color = GetWidget()->GetThemeProvider()-> |
1926 GetColor(ThemeService::COLOR_TOOLBAR); | 1882 GetColor(ThemeService::COLOR_TOOLBAR); |
1927 | 1883 |
1928 bool sidebar_allowed = SidebarManager::IsSidebarAllowed(); | |
1929 if (sidebar_allowed) { | |
1930 sidebar_container_ = new TabContentsContainer; | |
1931 sidebar_container_->set_id(VIEW_ID_SIDE_BAR_CONTAINER); | |
1932 sidebar_container_->SetVisible(false); | |
1933 | |
1934 sidebar_split_ = new views::SingleSplitView( | |
1935 contents_, | |
1936 sidebar_container_, | |
1937 views::SingleSplitView::HORIZONTAL_SPLIT, | |
1938 this); | |
1939 sidebar_split_->set_id(VIEW_ID_SIDE_BAR_SPLIT); | |
1940 sidebar_split_->SetAccessibleName( | |
1941 l10n_util::GetStringUTF16(IDS_ACCNAME_SIDE_BAR)); | |
1942 sidebar_split_->set_background( | |
1943 views::Background::CreateSolidBackground(bg_color)); | |
1944 } | |
1945 | |
1946 devtools_container_ = new TabContentsContainer; | 1884 devtools_container_ = new TabContentsContainer; |
1947 devtools_container_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 1885 devtools_container_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
1948 devtools_container_->SetVisible(false); | 1886 devtools_container_->SetVisible(false); |
1949 | 1887 |
1950 views::View* contents_view = contents_; | 1888 views::View* contents_view = contents_; |
1951 if (sidebar_allowed) | |
1952 contents_view = sidebar_split_; | |
1953 | 1889 |
1954 contents_split_ = new views::SingleSplitView( | 1890 contents_split_ = new views::SingleSplitView( |
1955 contents_view, | 1891 contents_view, |
1956 devtools_container_, | 1892 devtools_container_, |
1957 views::SingleSplitView::VERTICAL_SPLIT, | 1893 views::SingleSplitView::VERTICAL_SPLIT, |
1958 this); | 1894 this); |
1959 contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT); | 1895 contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT); |
1960 contents_split_->SetAccessibleName( | 1896 contents_split_->SetAccessibleName( |
1961 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)); | 1897 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)); |
1962 contents_split_->set_background( | 1898 contents_split_->set_background( |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); | 2019 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); |
2084 } | 2020 } |
2085 | 2021 |
2086 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) { | 2022 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) { |
2087 // TODO(beng): Remove this function once the interface between | 2023 // TODO(beng): Remove this function once the interface between |
2088 // InfoBarContainer, DownloadShelfView and TabContents and this | 2024 // InfoBarContainer, DownloadShelfView and TabContents and this |
2089 // view is sorted out. | 2025 // view is sorted out. |
2090 return true; | 2026 return true; |
2091 } | 2027 } |
2092 | 2028 |
2093 void BrowserView::UpdateSidebar() { | |
2094 UpdateSidebarForContents(GetSelectedTabContentsWrapper()); | |
2095 Layout(); | |
2096 } | |
2097 | |
2098 void BrowserView::UpdateSidebarForContents(TabContentsWrapper* tab_contents) { | |
2099 if (!sidebar_container_) | |
2100 return; // Happens when sidebar is not allowed. | |
2101 if (!SidebarManager::GetInstance()) | |
2102 return; // Happens only in tests. | |
2103 | |
2104 TabContents* sidebar_contents = NULL; | |
2105 if (tab_contents) { | |
2106 SidebarContainer* client_host = SidebarManager::GetInstance()-> | |
2107 GetActiveSidebarContainerFor(tab_contents->tab_contents()); | |
2108 if (client_host) | |
2109 sidebar_contents = client_host->sidebar_contents(); | |
2110 } | |
2111 | |
2112 bool visible = NULL != sidebar_contents && | |
2113 browser_->SupportsWindowFeature(Browser::FEATURE_SIDEBAR); | |
2114 | |
2115 bool should_show = visible && !sidebar_container_->visible(); | |
2116 bool should_hide = !visible && sidebar_container_->visible(); | |
2117 | |
2118 // Update sidebar content. | |
2119 TabContents* old_contents = sidebar_container_->tab_contents(); | |
2120 sidebar_container_->ChangeTabContents(sidebar_contents); | |
2121 SidebarManager::GetInstance()-> | |
2122 NotifyStateChanges(old_contents, sidebar_contents); | |
2123 | |
2124 // Update sidebar UI width. | |
2125 if (should_show) { | |
2126 // Restore split offset. | |
2127 int sidebar_width = g_browser_process->local_state()->GetInteger( | |
2128 prefs::kExtensionSidebarWidth); | |
2129 if (sidebar_width < 0) { | |
2130 // Initial load, set to default value. | |
2131 sidebar_width = sidebar_split_->width() / 7; | |
2132 } | |
2133 // Make sure user can see both panes. | |
2134 int min_sidebar_width = sidebar_split_->GetMinimumSize().width(); | |
2135 sidebar_width = std::min(sidebar_split_->width() - min_sidebar_width, | |
2136 std::max(min_sidebar_width, sidebar_width)); | |
2137 | |
2138 sidebar_split_->set_divider_offset( | |
2139 sidebar_split_->width() - sidebar_width); | |
2140 | |
2141 sidebar_container_->SetVisible(true); | |
2142 sidebar_split_->InvalidateLayout(); | |
2143 Layout(); | |
2144 } else if (should_hide) { | |
2145 // Store split offset when hiding sidebar only. | |
2146 g_browser_process->local_state()->SetInteger( | |
2147 prefs::kExtensionSidebarWidth, | |
2148 sidebar_split_->width() - sidebar_split_->divider_offset()); | |
2149 | |
2150 sidebar_container_->SetVisible(false); | |
2151 sidebar_split_->InvalidateLayout(); | |
2152 Layout(); | |
2153 } | |
2154 } | |
2155 | |
2156 void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) { | 2029 void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) { |
2157 TabContents* devtools_contents = NULL; | 2030 TabContents* devtools_contents = NULL; |
2158 if (wrapper) { | 2031 if (wrapper) { |
2159 TabContentsWrapper* devtools_contents_wrapper = | 2032 TabContentsWrapper* devtools_contents_wrapper = |
2160 DevToolsWindow::GetDevToolsContents(wrapper->tab_contents()); | 2033 DevToolsWindow::GetDevToolsContents(wrapper->tab_contents()); |
2161 if (devtools_contents_wrapper) | 2034 if (devtools_contents_wrapper) |
2162 devtools_contents = devtools_contents_wrapper->tab_contents(); | 2035 devtools_contents = devtools_contents_wrapper->tab_contents(); |
2163 } | 2036 } |
2164 | 2037 |
2165 bool should_show = devtools_contents && !devtools_container_->visible(); | 2038 bool should_show = devtools_contents && !devtools_container_->visible(); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 contents_container_->ChangeTabContents(NULL); | 2459 contents_container_->ChangeTabContents(NULL); |
2587 infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); | 2460 infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); |
2588 if (bookmark_bar_view_.get()) { | 2461 if (bookmark_bar_view_.get()) { |
2589 bookmark_bar_view_->SetBookmarkBarState( | 2462 bookmark_bar_view_->SetBookmarkBarState( |
2590 browser_->bookmark_bar_state(), | 2463 browser_->bookmark_bar_state(), |
2591 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 2464 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
2592 } | 2465 } |
2593 UpdateUIForContents(new_contents); | 2466 UpdateUIForContents(new_contents); |
2594 if (change_tab_contents) | 2467 if (change_tab_contents) |
2595 contents_container_->ChangeTabContents(new_contents->tab_contents()); | 2468 contents_container_->ChangeTabContents(new_contents->tab_contents()); |
2596 UpdateSidebarForContents(new_contents); | |
2597 | 2469 |
2598 UpdateDevToolsForContents(new_contents); | 2470 UpdateDevToolsForContents(new_contents); |
2599 // TODO(beng): This should be called automatically by ChangeTabContents, but I | 2471 // TODO(beng): This should be called automatically by ChangeTabContents, but I |
2600 // am striving for parity now rather than cleanliness. This is | 2472 // am striving for parity now rather than cleanliness. This is |
2601 // required to make features like Duplicate Tab, Undo Close Tab, | 2473 // required to make features like Duplicate Tab, Undo Close Tab, |
2602 // etc not result in sad tab. | 2474 // etc not result in sad tab. |
2603 new_contents->tab_contents()->DidBecomeSelected(); | 2475 new_contents->tab_contents()->DidBecomeSelected(); |
2604 if (BrowserList::GetLastActive() == browser_ && | 2476 if (BrowserList::GetLastActive() == browser_ && |
2605 !browser_->tabstrip_model()->closing_all() && GetWidget()->IsVisible()) { | 2477 !browser_->tabstrip_model()->closing_all() && GetWidget()->IsVisible()) { |
2606 // We only restore focus if our window is visible, to avoid invoking blur | 2478 // We only restore focus if our window is visible, to avoid invoking blur |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 browser::CreateViewsBubble(bubble); | 2526 browser::CreateViewsBubble(bubble); |
2655 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2527 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
2656 bubble->Show(); | 2528 bubble->Show(); |
2657 } | 2529 } |
2658 | 2530 |
2659 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2531 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
2660 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2532 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
2661 if (button) | 2533 if (button) |
2662 button->ShowAvatarBubble(); | 2534 button->ShowAvatarBubble(); |
2663 } | 2535 } |
OLD | NEW |