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::NOTIFICATION_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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 return sidebar_container_->GetFocusView(); | 1388 return sidebar_container_->GetFocusView(); |
1388 } | 1389 } |
1389 | 1390 |
1390 ToolbarView* BrowserView::GetToolbarView() const { | 1391 ToolbarView* BrowserView::GetToolbarView() const { |
1391 return toolbar_; | 1392 return toolbar_; |
1392 } | 1393 } |
1393 | 1394 |
1394 /////////////////////////////////////////////////////////////////////////////// | 1395 /////////////////////////////////////////////////////////////////////////////// |
1395 // BrowserView, NotificationObserver implementation: | 1396 // BrowserView, NotificationObserver implementation: |
1396 | 1397 |
1397 void BrowserView::Observe(NotificationType type, | 1398 void BrowserView::Observe(int type, |
1398 const NotificationSource& source, | 1399 const NotificationSource& source, |
1399 const NotificationDetails& details) { | 1400 const NotificationDetails& details) { |
1400 switch (type.value) { | 1401 switch (type) { |
1401 case NotificationType::SIDEBAR_CHANGED: | 1402 case chrome::NOTIFICATION_SIDEBAR_CHANGED: |
1402 if (Details<SidebarContainer>(details)->tab_contents() == | 1403 if (Details<SidebarContainer>(details)->tab_contents() == |
1403 browser_->GetSelectedTabContents()) { | 1404 browser_->GetSelectedTabContents()) { |
1404 UpdateSidebar(); | 1405 UpdateSidebar(); |
1405 } | 1406 } |
1406 break; | 1407 break; |
1407 | 1408 |
1408 default: | 1409 default: |
1409 NOTREACHED() << "Got a notification we didn't register for!"; | 1410 NOTREACHED() << "Got a notification we didn't register for!"; |
1410 break; | 1411 break; |
1411 } | 1412 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 // Tab strip isn't empty. Hide the frame (so it appears to have closed | 1723 // Tab strip isn't empty. Hide the frame (so it appears to have closed |
1723 // immediately) and close all the tabs, allowing the renderers to shut | 1724 // immediately) and close all the tabs, allowing the renderers to shut |
1724 // down. When the tab strip is empty we'll be called back again. | 1725 // down. When the tab strip is empty we'll be called back again. |
1725 frame_->Hide(); | 1726 frame_->Hide(); |
1726 browser_->OnWindowClosing(); | 1727 browser_->OnWindowClosing(); |
1727 return false; | 1728 return false; |
1728 } | 1729 } |
1729 | 1730 |
1730 // Empty TabStripModel, it's now safe to allow the Window to be closed. | 1731 // Empty TabStripModel, it's now safe to allow the Window to be closed. |
1731 NotificationService::current()->Notify( | 1732 NotificationService::current()->Notify( |
1732 NotificationType::WINDOW_CLOSED, | 1733 chrome::NOTIFICATION_WINDOW_CLOSED, |
1733 Source<gfx::NativeWindow>(frame_->GetNativeWindow()), | 1734 Source<gfx::NativeWindow>(frame_->GetNativeWindow()), |
1734 NotificationService::NoDetails()); | 1735 NotificationService::NoDetails()); |
1735 return true; | 1736 return true; |
1736 } | 1737 } |
1737 | 1738 |
1738 int BrowserView::NonClientHitTest(const gfx::Point& point) { | 1739 int BrowserView::NonClientHitTest(const gfx::Point& point) { |
1739 #if defined(OS_WIN) | 1740 #if defined(OS_WIN) |
1740 // The following code is not in the LayoutManager because it's | 1741 // The following code is not in the LayoutManager because it's |
1741 // independent of layout and also depends on the ResizeCorner which | 1742 // independent of layout and also depends on the ResizeCorner which |
1742 // is private. | 1743 // is private. |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2636 view->GetWidget()->non_client_view()->SetAccessibleName( | 2637 view->GetWidget()->non_client_view()->SetAccessibleName( |
2637 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2638 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2638 return view; | 2639 return view; |
2639 } | 2640 } |
2640 #endif | 2641 #endif |
2641 | 2642 |
2642 // static | 2643 // static |
2643 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2644 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2644 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2645 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2645 } | 2646 } |
OLD | NEW |