| 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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 return browser_->GetCurrentPageIcon(); | 1547 return browser_->GetCurrentPageIcon(); |
| 1548 return SkBitmap(); | 1548 return SkBitmap(); |
| 1549 } | 1549 } |
| 1550 | 1550 |
| 1551 bool BrowserView::ShouldShowWindowIcon() const { | 1551 bool BrowserView::ShouldShowWindowIcon() const { |
| 1552 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1552 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 bool BrowserView::ExecuteWindowsCommand(int command_id) { | 1555 bool BrowserView::ExecuteWindowsCommand(int command_id) { |
| 1556 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. | 1556 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. |
| 1557 #if defined(OS_WIN) | 1557 |
| 1558 if (command_id == IDC_DEBUG_FRAME_TOGGLE) | |
| 1559 GetWindow()->DebugToggleFrameType(); | |
| 1560 #endif | |
| 1561 // Translate WM_APPCOMMAND command ids into a command id that the browser | 1558 // Translate WM_APPCOMMAND command ids into a command id that the browser |
| 1562 // knows how to handle. | 1559 // knows how to handle. |
| 1563 int command_id_from_app_command = GetCommandIDForAppCommandID(command_id); | 1560 int command_id_from_app_command = GetCommandIDForAppCommandID(command_id); |
| 1564 if (command_id_from_app_command != -1) | 1561 if (command_id_from_app_command != -1) |
| 1565 command_id = command_id_from_app_command; | 1562 command_id = command_id_from_app_command; |
| 1566 | 1563 |
| 1567 return browser_->ExecuteCommandIfEnabled(command_id); | 1564 return browser_->ExecuteCommandIfEnabled(command_id); |
| 1568 } | 1565 } |
| 1569 | 1566 |
| 1570 std::wstring BrowserView::GetWindowName() const { | 1567 std::wstring BrowserView::GetWindowName() const { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 Layout(); | 1794 Layout(); |
| 1798 } | 1795 } |
| 1799 | 1796 |
| 1800 void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { | 1797 void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 1801 state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 1798 state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 1802 state->role = ui::AccessibilityTypes::ROLE_CLIENT; | 1799 state->role = ui::AccessibilityTypes::ROLE_CLIENT; |
| 1803 } | 1800 } |
| 1804 | 1801 |
| 1805 SkColor BrowserView::GetInfoBarSeparatorColor() const { | 1802 SkColor BrowserView::GetInfoBarSeparatorColor() const { |
| 1806 // NOTE: Keep this in sync with ToolbarView::OnPaint()! | 1803 // NOTE: Keep this in sync with ToolbarView::OnPaint()! |
| 1807 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? | 1804 return (IsTabStripVisible() || !frame_->non_client_view()->UseNativeFrame()) ? |
| 1808 ResourceBundle::toolbar_separator_color : SK_ColorBLACK; | 1805 ResourceBundle::toolbar_separator_color : SK_ColorBLACK; |
| 1809 } | 1806 } |
| 1810 | 1807 |
| 1811 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { | 1808 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { |
| 1812 ToolbarSizeChanged(is_animating); | 1809 ToolbarSizeChanged(is_animating); |
| 1813 } | 1810 } |
| 1814 | 1811 |
| 1815 bool BrowserView::DrawInfoBarArrows(int* x) const { | 1812 bool BrowserView::DrawInfoBarArrows(int* x) const { |
| 1816 if (x) { | 1813 if (x) { |
| 1817 const LocationIconView* location_icon_view = | 1814 const LocationIconView* location_icon_view = |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 } | 2349 } |
| 2353 | 2350 |
| 2354 #if defined(OS_WIN) | 2351 #if defined(OS_WIN) |
| 2355 void BrowserView::BuildSystemMenuForBrowserWindow() { | 2352 void BrowserView::BuildSystemMenuForBrowserWindow() { |
| 2356 system_menu_contents_->AddSeparator(); | 2353 system_menu_contents_->AddSeparator(); |
| 2357 system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER, | 2354 system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER, |
| 2358 IDS_TASK_MANAGER); | 2355 IDS_TASK_MANAGER); |
| 2359 system_menu_contents_->AddSeparator(); | 2356 system_menu_contents_->AddSeparator(); |
| 2360 system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 2357 system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
| 2361 system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); | 2358 system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); |
| 2362 AddFrameToggleItems(); | |
| 2363 // If it's a regular browser window with tabs, we don't add any more items, | 2359 // If it's a regular browser window with tabs, we don't add any more items, |
| 2364 // since it already has menus (Page, Chrome). | 2360 // since it already has menus (Page, Chrome). |
| 2365 } | 2361 } |
| 2366 | 2362 |
| 2367 void BrowserView::BuildSystemMenuForAppOrPopupWindow() { | 2363 void BrowserView::BuildSystemMenuForAppOrPopupWindow() { |
| 2368 if (browser_->is_app()) { | 2364 if (browser_->is_app()) { |
| 2369 system_menu_contents_->AddSeparator(); | 2365 system_menu_contents_->AddSeparator(); |
| 2370 system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER, | 2366 system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER, |
| 2371 IDS_TASK_MANAGER); | 2367 IDS_TASK_MANAGER); |
| 2372 } | 2368 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2393 IDS_SHOW_AS_TAB); | 2389 IDS_SHOW_AS_TAB); |
| 2394 } | 2390 } |
| 2395 system_menu_contents_->AddItemWithStringId(IDC_COPY_URL, | 2391 system_menu_contents_->AddItemWithStringId(IDC_COPY_URL, |
| 2396 IDS_APP_MENU_COPY_URL); | 2392 IDS_APP_MENU_COPY_URL); |
| 2397 system_menu_contents_->AddSeparator(); | 2393 system_menu_contents_->AddSeparator(); |
| 2398 system_menu_contents_->AddItemWithStringId(IDC_RELOAD, IDS_APP_MENU_RELOAD); | 2394 system_menu_contents_->AddItemWithStringId(IDC_RELOAD, IDS_APP_MENU_RELOAD); |
| 2399 system_menu_contents_->AddItemWithStringId(IDC_FORWARD, | 2395 system_menu_contents_->AddItemWithStringId(IDC_FORWARD, |
| 2400 IDS_CONTENT_CONTEXT_FORWARD); | 2396 IDS_CONTENT_CONTEXT_FORWARD); |
| 2401 system_menu_contents_->AddItemWithStringId(IDC_BACK, | 2397 system_menu_contents_->AddItemWithStringId(IDC_BACK, |
| 2402 IDS_CONTENT_CONTEXT_BACK); | 2398 IDS_CONTENT_CONTEXT_BACK); |
| 2403 AddFrameToggleItems(); | |
| 2404 } | |
| 2405 | |
| 2406 void BrowserView::AddFrameToggleItems() { | |
| 2407 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 2408 switches::kDebugEnableFrameToggle)) { | |
| 2409 system_menu_contents_->AddSeparator(); | |
| 2410 system_menu_contents_->AddItem(IDC_DEBUG_FRAME_TOGGLE, | |
| 2411 L"Toggle Frame Type"); | |
| 2412 } | |
| 2413 } | 2399 } |
| 2414 #endif | 2400 #endif |
| 2415 | 2401 |
| 2416 int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const { | 2402 int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const { |
| 2417 #if defined(OS_WIN) | 2403 #if defined(OS_WIN) |
| 2418 switch (app_command_id) { | 2404 switch (app_command_id) { |
| 2419 // NOTE: The order here matches the APPCOMMAND declaration order in the | 2405 // NOTE: The order here matches the APPCOMMAND declaration order in the |
| 2420 // Windows headers. | 2406 // Windows headers. |
| 2421 case APPCOMMAND_BROWSER_BACKWARD: return IDC_BACK; | 2407 case APPCOMMAND_BROWSER_BACKWARD: return IDC_BACK; |
| 2422 case APPCOMMAND_BROWSER_FORWARD: return IDC_FORWARD; | 2408 case APPCOMMAND_BROWSER_FORWARD: return IDC_FORWARD; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 view->GetWindow()->non_client_view()->SetAccessibleName( | 2579 view->GetWindow()->non_client_view()->SetAccessibleName( |
| 2594 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2580 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2595 return view; | 2581 return view; |
| 2596 } | 2582 } |
| 2597 #endif | 2583 #endif |
| 2598 | 2584 |
| 2599 // static | 2585 // static |
| 2600 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2586 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2601 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2587 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2602 } | 2588 } |
| OLD | NEW |