| 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/chromeos/frame/browser_view.h" | 5 #include "chrome/browser/chromeos/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 WindowOpenDisposition BrowserView::GetDispositionForPopupBounds( | 455 WindowOpenDisposition BrowserView::GetDispositionForPopupBounds( |
| 456 const gfx::Rect& bounds) { | 456 const gfx::Rect& bounds) { |
| 457 GdkScreen* screen = gdk_screen_get_default(); | 457 GdkScreen* screen = gdk_screen_get_default(); |
| 458 int width = gdk_screen_get_width(screen); | 458 int width = gdk_screen_get_width(screen); |
| 459 int height = gdk_screen_get_height(screen); | 459 int height = gdk_screen_get_height(screen); |
| 460 return browser::DispositionForPopupBounds(bounds, width, height); | 460 return browser::DispositionForPopupBounds(bounds, width, height); |
| 461 } | 461 } |
| 462 | 462 |
| 463 // views::ContextMenuController implementation. | 463 // views::ContextMenuController implementation. |
| 464 void BrowserView::ShowContextMenuForView(views::View* source, | 464 void BrowserView::ShowContextMenuForView(views::View* source, |
| 465 const gfx::Point& p, | 465 const gfx::Point& point) { |
| 466 bool is_mouse_gesture) { | |
| 467 // Only show context menu if point is in unobscured parts of browser, i.e. | 466 // Only show context menu if point is in unobscured parts of browser, i.e. |
| 468 // if NonClientHitTest returns : | 467 // if NonClientHitTest returns : |
| 469 // - HTCAPTION: in title bar or unobscured part of tabstrip | 468 // - HTCAPTION: in title bar or unobscured part of tabstrip |
| 470 // - HTNOWHERE: as the name implies. | 469 // - HTNOWHERE: as the name implies. |
| 471 gfx::Point point_in_parent_coords(p); | 470 gfx::Point point_in_parent_coords(point); |
| 472 views::View::ConvertPointToView(NULL, parent(), &point_in_parent_coords); | 471 views::View::ConvertPointToView(NULL, parent(), &point_in_parent_coords); |
| 473 int hit_test = NonClientHitTest(point_in_parent_coords); | 472 int hit_test = NonClientHitTest(point_in_parent_coords); |
| 474 if (hit_test == HTCAPTION || hit_test == HTNOWHERE) { | 473 if (hit_test == HTCAPTION || hit_test == HTNOWHERE) { |
| 475 // rebuild menu so it reflects current application state | 474 // rebuild menu so it reflects current application state |
| 476 InitSystemMenu(); | 475 InitSystemMenu(); |
| 477 if (system_menu_runner_->RunMenuAt(source->GetWidget(), NULL, | 476 if (system_menu_runner_->RunMenuAt(source->GetWidget(), NULL, |
| 478 gfx::Rect(p, gfx::Size(0,0)), views::MenuItemView::TOPLEFT, | 477 gfx::Rect(point, gfx::Size()), views::MenuItemView::TOPLEFT, |
| 479 views::MenuRunner::HAS_MNEMONICS) == | 478 views::MenuRunner::HAS_MNEMONICS) == |
| 480 views::MenuRunner::MENU_DELETED) | 479 views::MenuRunner::MENU_DELETED) |
| 481 return; | 480 return; |
| 482 } | 481 } |
| 483 } | 482 } |
| 484 | 483 |
| 485 // BrowserView, views::MenuListener implementation. | 484 // BrowserView, views::MenuListener implementation. |
| 486 void BrowserView::OnMenuOpened() { | 485 void BrowserView::OnMenuOpened() { |
| 487 // Save the focused widget before wrench menu opens. | 486 // Save the focused widget before wrench menu opens. |
| 488 saved_focused_widget_ = gtk_window_get_focus(GetNativeHandle()); | 487 saved_focused_widget_ = gtk_window_get_focus(GetNativeHandle()); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 634 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 636 // Create a browser view for chromeos. | 635 // Create a browser view for chromeos. |
| 637 BrowserView* view; | 636 BrowserView* view; |
| 638 if (browser->is_type_popup() || browser->is_type_panel()) | 637 if (browser->is_type_popup() || browser->is_type_panel()) |
| 639 view = new chromeos::PanelBrowserView(browser); | 638 view = new chromeos::PanelBrowserView(browser); |
| 640 else | 639 else |
| 641 view = new chromeos::BrowserView(browser); | 640 view = new chromeos::BrowserView(browser); |
| 642 (new BrowserFrame(view))->InitBrowserFrame(); | 641 (new BrowserFrame(view))->InitBrowserFrame(); |
| 643 return view; | 642 return view; |
| 644 } | 643 } |
| OLD | NEW |