| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/panels/old_panel.h" | |
| 6 | |
| 7 #include "chrome/browser/favicon/favicon_tab_helper.h" | |
| 8 #include "chrome/browser/ui/browser.h" | |
| 9 #include "chrome/browser/ui/browser_command_controller.h" | |
| 10 #include "chrome/browser/ui/browser_commands.h" | |
| 11 #include "chrome/browser/ui/browser_tabstrip.h" | |
| 12 #include "chrome/browser/ui/panels/panel_browser_window.h" | |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" | |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
| 15 #include "ui/gfx/image/image.h" | |
| 16 | |
| 17 OldPanel::OldPanel(Browser* browser, | |
| 18 const gfx::Size& min_size, const gfx::Size& max_size) | |
| 19 : Panel(browser->app_name(), min_size, max_size), | |
| 20 browser_(browser) { | |
| 21 } | |
| 22 | |
| 23 OldPanel::~OldPanel() {} | |
| 24 | |
| 25 Browser* OldPanel::browser() const { | |
| 26 return browser_; | |
| 27 } | |
| 28 | |
| 29 BrowserWindow* OldPanel::browser_window() const { | |
| 30 return panel_browser_window_.get(); | |
| 31 } | |
| 32 | |
| 33 CommandUpdater* OldPanel::command_updater() { | |
| 34 return browser_->command_controller()->command_updater(); | |
| 35 } | |
| 36 | |
| 37 Profile* OldPanel::profile() const { | |
| 38 return browser_->profile(); | |
| 39 } | |
| 40 | |
| 41 void OldPanel::Initialize(const gfx::Rect& bounds, Browser* browser) { | |
| 42 Panel::Initialize(bounds, browser); | |
| 43 panel_browser_window_.reset( | |
| 44 new PanelBrowserWindow(browser, this, native_panel())); | |
| 45 } | |
| 46 | |
| 47 content::WebContents* OldPanel::GetWebContents() const { | |
| 48 return chrome::GetActiveWebContents(browser_); | |
| 49 } | |
| 50 | |
| 51 bool OldPanel::ShouldCloseWindow() { | |
| 52 return browser_->ShouldCloseWindow(); | |
| 53 } | |
| 54 | |
| 55 void OldPanel::OnWindowClosing() { | |
| 56 browser_->OnWindowClosing(); | |
| 57 } | |
| 58 | |
| 59 void OldPanel::ExecuteCommandWithDisposition( | |
| 60 int id, WindowOpenDisposition disposition) { | |
| 61 chrome::ExecuteCommandWithDisposition(browser_, id, disposition); | |
| 62 } | |
| 63 | |
| 64 gfx::Image OldPanel::GetCurrentPageIcon() const { | |
| 65 // Browser has not been changed to return SkBitmap yet so we get the favicon | |
| 66 // directly rather than use browser_->GetCurrentPageIcon(). | |
| 67 TabContents* contents = chrome::GetActiveTabContents(browser_); | |
| 68 return contents ? contents->favicon_tab_helper()->GetFavicon() : gfx::Image(); | |
| 69 } | |
| OLD | NEW |