| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 62 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
| 63 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 63 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 64 #include "chrome/browser/ui/views/tabs/tab_strip_factory.h" | 64 #include "chrome/browser/ui/views/tabs/tab_strip_factory.h" |
| 65 #include "chrome/browser/ui/views/theme_install_bubble_view.h" | 65 #include "chrome/browser/ui/views/theme_install_bubble_view.h" |
| 66 #include "chrome/browser/ui/views/toolbar_view.h" | 66 #include "chrome/browser/ui/views/toolbar_view.h" |
| 67 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 67 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| 68 #include "chrome/browser/ui/views/window.h" | 68 #include "chrome/browser/ui/views/window.h" |
| 69 #include "chrome/browser/ui/webui/bug_report_ui.h" | 69 #include "chrome/browser/ui/webui/bug_report_ui.h" |
| 70 #include "chrome/browser/ui/webui/task_manager_dialog.h" | 70 #include "chrome/browser/ui/webui/task_manager_dialog.h" |
| 71 #include "chrome/browser/ui/window_sizer.h" | 71 #include "chrome/browser/ui/window_sizer.h" |
| 72 #include "chrome/common/chrome_notification_types.h" |
| 72 #include "chrome/common/chrome_switches.h" | 73 #include "chrome/common/chrome_switches.h" |
| 73 #include "chrome/common/extensions/extension_resource.h" | 74 #include "chrome/common/extensions/extension_resource.h" |
| 74 #include "chrome/common/native_window_notification_source.h" | 75 #include "chrome/common/native_window_notification_source.h" |
| 75 #include "chrome/common/pref_names.h" | 76 #include "chrome/common/pref_names.h" |
| 76 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
| 77 #include "content/browser/debugger/devtools_window.h" | 78 #include "content/browser/debugger/devtools_window.h" |
| 78 #include "content/browser/renderer_host/render_view_host.h" | 79 #include "content/browser/renderer_host/render_view_host.h" |
| 79 #include "content/browser/renderer_host/render_widget_host_view.h" | 80 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 80 #include "content/browser/tab_contents/tab_contents.h" | 81 #include "content/browser/tab_contents/tab_contents.h" |
| 81 #include "content/browser/tab_contents/tab_contents_view.h" | 82 #include "content/browser/tab_contents/tab_contents_view.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 initialized_(false), | 331 initialized_(false), |
| 331 ignore_layout_(true) | 332 ignore_layout_(true) |
| 332 #if defined(OS_WIN) | 333 #if defined(OS_WIN) |
| 333 , hung_window_detector_(&hung_plugin_action_), | 334 , hung_window_detector_(&hung_plugin_action_), |
| 334 ticker_(0) | 335 ticker_(0) |
| 335 #endif | 336 #endif |
| 336 { | 337 { |
| 337 browser_->tabstrip_model()->AddObserver(this); | 338 browser_->tabstrip_model()->AddObserver(this); |
| 338 | 339 |
| 339 registrar_.Add(this, | 340 registrar_.Add(this, |
| 340 NotificationType::SIDEBAR_CHANGED, | 341 chrome::SIDEBAR_CHANGED, |
| 341 Source<SidebarManager>(SidebarManager::GetInstance())); | 342 Source<SidebarManager>(SidebarManager::GetInstance())); |
| 342 } | 343 } |
| 343 | 344 |
| 344 BrowserView::~BrowserView() { | 345 BrowserView::~BrowserView() { |
| 345 browser_->tabstrip_model()->RemoveObserver(this); | 346 browser_->tabstrip_model()->RemoveObserver(this); |
| 346 | 347 |
| 347 #if defined(OS_WIN) | 348 #if defined(OS_WIN) |
| 348 // Remove this observer. | 349 // Remove this observer. |
| 349 if (aeropeek_manager_.get()) | 350 if (aeropeek_manager_.get()) |
| 350 browser_->tabstrip_model()->RemoveObserver(aeropeek_manager_.get()); | 351 browser_->tabstrip_model()->RemoveObserver(aeropeek_manager_.get()); |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 return toolbar_; | 1393 return toolbar_; |
| 1393 } | 1394 } |
| 1394 | 1395 |
| 1395 /////////////////////////////////////////////////////////////////////////////// | 1396 /////////////////////////////////////////////////////////////////////////////// |
| 1396 // BrowserView, NotificationObserver implementation: | 1397 // BrowserView, NotificationObserver implementation: |
| 1397 | 1398 |
| 1398 void BrowserView::Observe(NotificationType type, | 1399 void BrowserView::Observe(NotificationType type, |
| 1399 const NotificationSource& source, | 1400 const NotificationSource& source, |
| 1400 const NotificationDetails& details) { | 1401 const NotificationDetails& details) { |
| 1401 switch (type.value) { | 1402 switch (type.value) { |
| 1402 case NotificationType::SIDEBAR_CHANGED: | 1403 case chrome::SIDEBAR_CHANGED: |
| 1403 if (Details<SidebarContainer>(details)->tab_contents() == | 1404 if (Details<SidebarContainer>(details)->tab_contents() == |
| 1404 browser_->GetSelectedTabContents()) { | 1405 browser_->GetSelectedTabContents()) { |
| 1405 UpdateSidebar(); | 1406 UpdateSidebar(); |
| 1406 } | 1407 } |
| 1407 break; | 1408 break; |
| 1408 | 1409 |
| 1409 default: | 1410 default: |
| 1410 NOTREACHED() << "Got a notification we didn't register for!"; | 1411 NOTREACHED() << "Got a notification we didn't register for!"; |
| 1411 break; | 1412 break; |
| 1412 } | 1413 } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 // Tab strip isn't empty. Hide the frame (so it appears to have closed | 1724 // Tab strip isn't empty. Hide the frame (so it appears to have closed |
| 1724 // immediately) and close all the tabs, allowing the renderers to shut | 1725 // immediately) and close all the tabs, allowing the renderers to shut |
| 1725 // down. When the tab strip is empty we'll be called back again. | 1726 // down. When the tab strip is empty we'll be called back again. |
| 1726 frame_->Hide(); | 1727 frame_->Hide(); |
| 1727 browser_->OnWindowClosing(); | 1728 browser_->OnWindowClosing(); |
| 1728 return false; | 1729 return false; |
| 1729 } | 1730 } |
| 1730 | 1731 |
| 1731 // Empty TabStripModel, it's now safe to allow the Window to be closed. | 1732 // Empty TabStripModel, it's now safe to allow the Window to be closed. |
| 1732 NotificationService::current()->Notify( | 1733 NotificationService::current()->Notify( |
| 1733 NotificationType::WINDOW_CLOSED, | 1734 chrome::WINDOW_CLOSED, |
| 1734 Source<gfx::NativeWindow>(frame_->GetNativeWindow()), | 1735 Source<gfx::NativeWindow>(frame_->GetNativeWindow()), |
| 1735 NotificationService::NoDetails()); | 1736 NotificationService::NoDetails()); |
| 1736 return true; | 1737 return true; |
| 1737 } | 1738 } |
| 1738 | 1739 |
| 1739 int BrowserView::NonClientHitTest(const gfx::Point& point) { | 1740 int BrowserView::NonClientHitTest(const gfx::Point& point) { |
| 1740 #if defined(OS_WIN) | 1741 #if defined(OS_WIN) |
| 1741 // The following code is not in the LayoutManager because it's | 1742 // The following code is not in the LayoutManager because it's |
| 1742 // independent of layout and also depends on the ResizeCorner which | 1743 // independent of layout and also depends on the ResizeCorner which |
| 1743 // is private. | 1744 // is private. |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2637 view->GetWidget()->non_client_view()->SetAccessibleName( | 2638 view->GetWidget()->non_client_view()->SetAccessibleName( |
| 2638 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2639 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2639 return view; | 2640 return view; |
| 2640 } | 2641 } |
| 2641 #endif | 2642 #endif |
| 2642 | 2643 |
| 2643 // static | 2644 // static |
| 2644 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2645 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2645 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2646 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2646 } | 2647 } |
| OLD | NEW |