| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #include "ui/views/controls/single_split_view.h" | 95 #include "ui/views/controls/single_split_view.h" |
| 96 #include "ui/views/events/event.h" | 96 #include "ui/views/events/event.h" |
| 97 #include "ui/views/focus/external_focus_tracker.h" | 97 #include "ui/views/focus/external_focus_tracker.h" |
| 98 #include "ui/views/focus/view_storage.h" | 98 #include "ui/views/focus/view_storage.h" |
| 99 #include "ui/views/layout/grid_layout.h" | 99 #include "ui/views/layout/grid_layout.h" |
| 100 #include "ui/views/widget/native_widget.h" | 100 #include "ui/views/widget/native_widget.h" |
| 101 #include "ui/views/widget/root_view.h" | 101 #include "ui/views/widget/root_view.h" |
| 102 #include "ui/views/widget/widget.h" | 102 #include "ui/views/widget/widget.h" |
| 103 #include "ui/views/window/dialog_delegate.h" | 103 #include "ui/views/window/dialog_delegate.h" |
| 104 | 104 |
| 105 #if defined(USE_AURA) | 105 #if defined(USE_ASH) |
| 106 #include "ash/launcher/launcher.h" | 106 #include "ash/launcher/launcher.h" |
| 107 #include "ash/launcher/launcher_model.h" | 107 #include "ash/launcher/launcher_model.h" |
| 108 #include "ash/shell.h" | 108 #include "ash/shell.h" |
| 109 #include "chrome/browser/ui/views/accelerator_table.h" | |
| 110 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" | 109 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" |
| 111 #include "chrome/browser/ui/views/ash/launcher/launcher_updater.h" | 110 #include "chrome/browser/ui/views/ash/launcher/launcher_updater.h" |
| 112 #include "chrome/browser/ui/views/ash/window_positioner.h" | 111 #include "chrome/browser/ui/views/ash/window_positioner.h" |
| 113 #include "ui/gfx/screen.h" | |
| 114 #elif defined(OS_WIN) | 112 #elif defined(OS_WIN) |
| 115 #include "chrome/browser/aeropeek_manager.h" | 113 #include "chrome/browser/aeropeek_manager.h" |
| 116 #include "chrome/browser/jumplist_win.h" | 114 #include "chrome/browser/jumplist_win.h" |
| 117 #include "ui/views/widget/native_widget_win.h" | 115 #include "ui/views/widget/native_widget_win.h" |
| 118 #endif | 116 #endif |
| 119 | 117 |
| 118 #if defined(USE_AURA) |
| 119 #include "chrome/browser/ui/views/accelerator_table.h" |
| 120 #include "ui/gfx/screen.h" |
| 121 #endif |
| 122 |
| 120 #if defined(OS_CHROMEOS) | 123 #if defined(OS_CHROMEOS) |
| 121 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" | 124 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" |
| 122 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 125 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 123 #endif | 126 #endif |
| 124 | 127 |
| 125 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 128 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 126 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" | 129 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
| 127 #endif | 130 #endif |
| 128 | 131 |
| 129 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 132 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 hung_window_detector_(&hung_plugin_action_), | 352 hung_window_detector_(&hung_plugin_action_), |
| 350 ticker_(0), | 353 ticker_(0), |
| 351 #endif | 354 #endif |
| 352 force_location_bar_focus_(false), | 355 force_location_bar_focus_(false), |
| 353 move_observer_(NULL), | 356 move_observer_(NULL), |
| 354 ALLOW_THIS_IN_INITIALIZER_LIST(color_change_listener_(this)) { | 357 ALLOW_THIS_IN_INITIALIZER_LIST(color_change_listener_(this)) { |
| 355 browser_->tabstrip_model()->AddObserver(this); | 358 browser_->tabstrip_model()->AddObserver(this); |
| 356 } | 359 } |
| 357 | 360 |
| 358 BrowserView::~BrowserView() { | 361 BrowserView::~BrowserView() { |
| 359 #if defined(USE_AURA) | 362 #if defined(USE_ASH) |
| 360 // Destroy LauncherUpdater early on as it listens to the TabstripModel, which | 363 // Destroy LauncherUpdater early on as it listens to the TabstripModel, which |
| 361 // is destroyed by the browser. | 364 // is destroyed by the browser. |
| 362 icon_updater_.reset(); | 365 icon_updater_.reset(); |
| 363 #endif | 366 #endif |
| 364 | 367 |
| 365 browser_->tabstrip_model()->RemoveObserver(this); | 368 browser_->tabstrip_model()->RemoveObserver(this); |
| 366 | 369 |
| 367 #if defined(OS_WIN) && !defined(USE_AURA) | 370 #if defined(OS_WIN) && !defined(USE_AURA) |
| 368 // Remove this observer. | 371 // Remove this observer. |
| 369 if (aeropeek_manager_.get()) | 372 if (aeropeek_manager_.get()) |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 // Try to focus the next pane; if SetPaneFocusAndFocusDefault returns | 987 // Try to focus the next pane; if SetPaneFocusAndFocusDefault returns |
| 985 // false it means the pane didn't have any focusable controls, so skip | 988 // false it means the pane didn't have any focusable controls, so skip |
| 986 // it and try the next one. | 989 // it and try the next one. |
| 987 for (;;) { | 990 for (;;) { |
| 988 if (forwards) | 991 if (forwards) |
| 989 index = (index + 1) % count; | 992 index = (index + 1) % count; |
| 990 else | 993 else |
| 991 index = ((index - 1) + count) % count; | 994 index = ((index - 1) + count) % count; |
| 992 | 995 |
| 993 if (index == special_index) { | 996 if (index == special_index) { |
| 994 #if defined(OS_CHROMEOS) && defined(USE_AURA) | 997 #if defined(USE_ASH) |
| 995 ash::Shell::GetInstance()->RotateFocus( | 998 ash::Shell::GetInstance()->RotateFocus( |
| 996 forwards ? ash::Shell::FORWARD : ash::Shell::BACKWARD); | 999 forwards ? ash::Shell::FORWARD : ash::Shell::BACKWARD); |
| 1000 #endif |
| 997 break; | 1001 break; |
| 998 #endif | |
| 999 } else if (index < pane_count) { | 1002 } else if (index < pane_count) { |
| 1000 if (accessible_panes[index]->SetPaneFocusAndFocusDefault()) | 1003 if (accessible_panes[index]->SetPaneFocusAndFocusDefault()) |
| 1001 break; | 1004 break; |
| 1002 } else { | 1005 } else { |
| 1003 accessible_views[index]->RequestFocus(); | 1006 accessible_views[index]->RequestFocus(); |
| 1004 break; | 1007 break; |
| 1005 } | 1008 } |
| 1006 } | 1009 } |
| 1007 } | 1010 } |
| 1008 | 1011 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 views::View* BrowserView::GetContentsView() { | 1608 views::View* BrowserView::GetContentsView() { |
| 1606 return contents_container_; | 1609 return contents_container_; |
| 1607 } | 1610 } |
| 1608 | 1611 |
| 1609 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { | 1612 views::ClientView* BrowserView::CreateClientView(views::Widget* widget) { |
| 1610 return this; | 1613 return this; |
| 1611 } | 1614 } |
| 1612 | 1615 |
| 1613 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, | 1616 void BrowserView::OnWidgetActivationChanged(views::Widget* widget, |
| 1614 bool active) { | 1617 bool active) { |
| 1615 #if defined(USE_AURA) | 1618 #if defined(USE_ASH) |
| 1616 if (icon_updater_.get()) | 1619 if (icon_updater_.get()) |
| 1617 icon_updater_->BrowserActivationStateChanged(); | 1620 icon_updater_->BrowserActivationStateChanged(); |
| 1618 #endif | 1621 #endif |
| 1619 | 1622 |
| 1620 if (active) { | 1623 if (active) { |
| 1621 BrowserList::SetLastActive(browser_.get()); | 1624 BrowserList::SetLastActive(browser_.get()); |
| 1622 browser_->OnWindowActivated(); | 1625 browser_->OnWindowActivated(); |
| 1623 } | 1626 } |
| 1624 } | 1627 } |
| 1625 | 1628 |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 delete toolbar_; | 2442 delete toolbar_; |
| 2440 } | 2443 } |
| 2441 toolbar_ = toolbar; | 2444 toolbar_ = toolbar; |
| 2442 if (toolbar) { | 2445 if (toolbar) { |
| 2443 AddChildView(toolbar_); | 2446 AddChildView(toolbar_); |
| 2444 toolbar_->Init(); | 2447 toolbar_->Init(); |
| 2445 } | 2448 } |
| 2446 } | 2449 } |
| 2447 | 2450 |
| 2448 void BrowserView::CreateLauncherIcon() { | 2451 void BrowserView::CreateLauncherIcon() { |
| 2449 #if defined(USE_AURA) | 2452 #if defined(USE_ASH) |
| 2450 if (!icon_updater_.get()) | 2453 if (!icon_updater_.get()) |
| 2451 icon_updater_.reset(LauncherUpdater::Create(browser_.get())); | 2454 icon_updater_.reset(LauncherUpdater::Create(browser_.get())); |
| 2452 #endif // defined(USE_AURA) | 2455 #endif // defined(USE_AURA) |
| 2453 } | 2456 } |
| 2454 | 2457 |
| 2455 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 2458 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
| 2456 // static | 2459 // static |
| 2457 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2460 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2458 // Create the view and the frame. The frame will attach itself via the view | 2461 // Create the view and the frame. The frame will attach itself via the view |
| 2459 // so we don't need to do anything with the pointer. | 2462 // so we don't need to do anything with the pointer. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2496 return; | 2499 return; |
| 2497 | 2500 |
| 2498 PasswordGenerationBubbleView* bubble = | 2501 PasswordGenerationBubbleView* bubble = |
| 2499 new PasswordGenerationBubbleView(bounds, | 2502 new PasswordGenerationBubbleView(bounds, |
| 2500 this, | 2503 this, |
| 2501 web_contents->GetRenderViewHost()); | 2504 web_contents->GetRenderViewHost()); |
| 2502 views::BubbleDelegateView::CreateBubble(bubble); | 2505 views::BubbleDelegateView::CreateBubble(bubble); |
| 2503 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2506 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2504 bubble->Show(); | 2507 bubble->Show(); |
| 2505 } | 2508 } |
| OLD | NEW |