| 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 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 int contents_height = status_bubble_->base_view()->bounds().height(); | 2087 int contents_height = status_bubble_->base_view()->bounds().height(); |
| 2088 gfx::Point origin(-overlap, contents_height - height + overlap); | 2088 gfx::Point origin(-overlap, contents_height - height + overlap); |
| 2089 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height); | 2089 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height); |
| 2090 } | 2090 } |
| 2091 | 2091 |
| 2092 bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) { | 2092 bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) { |
| 2093 views::View* new_bookmark_bar_view = NULL; | 2093 views::View* new_bookmark_bar_view = NULL; |
| 2094 if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) && | 2094 if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) && |
| 2095 contents) { | 2095 contents) { |
| 2096 if (!bookmark_bar_view_.get()) { | 2096 if (!bookmark_bar_view_.get()) { |
| 2097 bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(), | 2097 bookmark_bar_view_.reset(new BookmarkBarView(browser_.get())); |
| 2098 browser_.get())); | |
| 2099 bookmark_bar_view_->set_parent_owned(false); | 2098 bookmark_bar_view_->set_parent_owned(false); |
| 2100 bookmark_bar_view_->set_background( | 2099 bookmark_bar_view_->set_background( |
| 2101 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), | 2100 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), |
| 2102 browser_.get())); | 2101 browser_.get())); |
| 2103 bookmark_bar_view_->SetBookmarkBarState( | 2102 bookmark_bar_view_->SetBookmarkBarState( |
| 2104 browser_->bookmark_bar_state(), | 2103 browser_->bookmark_bar_state(), |
| 2105 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 2104 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
| 2106 } else { | |
| 2107 bookmark_bar_view_->SetProfile(contents->profile()); | |
| 2108 } | 2105 } |
| 2109 bookmark_bar_view_->SetPageNavigator(contents->tab_contents()); | 2106 bookmark_bar_view_->SetPageNavigator(contents->tab_contents()); |
| 2110 new_bookmark_bar_view = bookmark_bar_view_.get(); | 2107 new_bookmark_bar_view = bookmark_bar_view_.get(); |
| 2111 } | 2108 } |
| 2112 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); | 2109 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); |
| 2113 } | 2110 } |
| 2114 | 2111 |
| 2115 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) { | 2112 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) { |
| 2116 // TODO(beng): Remove this function once the interface between | 2113 // TODO(beng): Remove this function once the interface between |
| 2117 // InfoBarContainer, DownloadShelfView and TabContents and this | 2114 // InfoBarContainer, DownloadShelfView and TabContents and this |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2637 } | 2634 } |
| 2638 | 2635 |
| 2639 void BrowserView::SetToolbar(ToolbarView* toolbar) { | 2636 void BrowserView::SetToolbar(ToolbarView* toolbar) { |
| 2640 if (toolbar_) { | 2637 if (toolbar_) { |
| 2641 RemoveChildView(toolbar_); | 2638 RemoveChildView(toolbar_); |
| 2642 delete toolbar_; | 2639 delete toolbar_; |
| 2643 } | 2640 } |
| 2644 toolbar_ = toolbar; | 2641 toolbar_ = toolbar; |
| 2645 if (toolbar) { | 2642 if (toolbar) { |
| 2646 AddChildView(toolbar_); | 2643 AddChildView(toolbar_); |
| 2647 toolbar_->Init(browser_->profile()); | 2644 toolbar_->Init(); |
| 2648 } | 2645 } |
| 2649 } | 2646 } |
| 2650 | 2647 |
| 2651 #if !defined(OS_CHROMEOS) | 2648 #if !defined(OS_CHROMEOS) |
| 2652 // static | 2649 // static |
| 2653 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2650 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2654 // Create the view and the frame. The frame will attach itself via the view | 2651 // Create the view and the frame. The frame will attach itself via the view |
| 2655 // so we don't need to do anything with the pointer. | 2652 // so we don't need to do anything with the pointer. |
| 2656 BrowserView* view = new BrowserView(browser); | 2653 BrowserView* view = new BrowserView(browser); |
| 2657 (new BrowserFrame(view))->InitBrowserFrame(); | 2654 (new BrowserFrame(view))->InitBrowserFrame(); |
| 2658 view->GetWidget()->non_client_view()->SetAccessibleName( | 2655 view->GetWidget()->non_client_view()->SetAccessibleName( |
| 2659 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2656 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2660 return view; | 2657 return view; |
| 2661 } | 2658 } |
| 2662 #endif | 2659 #endif |
| 2663 | 2660 |
| 2664 // static | 2661 // static |
| 2665 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2662 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2666 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2663 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2667 } | 2664 } |
| OLD | NEW |