| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/menus/simple_menu_model.h" | 10 #include "app/menus/simple_menu_model.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/views/tabs/tab_strip.h" | 26 #include "chrome/browser/views/tabs/tab_strip.h" |
| 27 #include "chrome/browser/views/toolbar_view.h" | 27 #include "chrome/browser/views/toolbar_view.h" |
| 28 #include "chrome/browser/views/toolbar_star_toggle.h" | 28 #include "chrome/browser/views/toolbar_star_toggle.h" |
| 29 #include "chrome/browser/view_ids.h" | 29 #include "chrome/browser/view_ids.h" |
| 30 #include "gfx/canvas.h" | 30 #include "gfx/canvas.h" |
| 31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 32 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 33 #include "views/controls/button/button.h" | 33 #include "views/controls/button/button.h" |
| 34 #include "views/controls/button/image_button.h" | 34 #include "views/controls/button/image_button.h" |
| 35 #include "views/controls/menu/menu_2.h" | 35 #include "views/controls/menu/menu_2.h" |
| 36 #include "views/widget/root_view.h" |
| 36 #include "views/window/hit_test.h" | 37 #include "views/window/hit_test.h" |
| 37 #include "views/window/window.h" | 38 #include "views/window/window.h" |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 // The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the | 42 // The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the |
| 42 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the | 43 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the |
| 43 // user). | 44 // user). |
| 44 const int kOTRBottomSpacing = 2; | 45 const int kOTRBottomSpacing = 2; |
| 45 | 46 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 if (is_compact_style()) | 440 if (is_compact_style()) |
| 440 compact_location_bar_host_->GetStarButton()->ShowStarBubble( | 441 compact_location_bar_host_->GetStarButton()->ShowStarBubble( |
| 441 url, !already_bookmarked); | 442 url, !already_bookmarked); |
| 442 else | 443 else |
| 443 ::BrowserView::ShowBookmarkBubble(url, already_bookmarked); | 444 ::BrowserView::ShowBookmarkBubble(url, already_bookmarked); |
| 444 } | 445 } |
| 445 | 446 |
| 446 // views::ButtonListener overrides. | 447 // views::ButtonListener overrides. |
| 447 void BrowserView::ButtonPressed(views::Button* sender, | 448 void BrowserView::ButtonPressed(views::Button* sender, |
| 448 const views::Event& event) { | 449 const views::Event& event) { |
| 449 AppLauncher::Show(browser()); | 450 gfx::Rect bounds = main_menu_button_->bounds(); |
| 451 gfx::Point origin = bounds.origin(); |
| 452 views::RootView::ConvertPointToScreen(this, &origin); |
| 453 bounds.set_origin(origin); |
| 454 ::AppLauncher::Show(browser(), bounds); |
| 450 } | 455 } |
| 451 | 456 |
| 452 // views::ContextMenuController overrides. | 457 // views::ContextMenuController overrides. |
| 453 void BrowserView::ShowContextMenu(views::View* source, | 458 void BrowserView::ShowContextMenu(views::View* source, |
| 454 const gfx::Point& p, | 459 const gfx::Point& p, |
| 455 bool is_mouse_gesture) { | 460 bool is_mouse_gesture) { |
| 456 // Only show context menu if point is in unobscured parts of browser, i.e. | 461 // Only show context menu if point is in unobscured parts of browser, i.e. |
| 457 // if NonClientHitTest returns : | 462 // if NonClientHitTest returns : |
| 458 // - HTCAPTION: in title bar or unobscured part of tabstrip | 463 // - HTCAPTION: in title bar or unobscured part of tabstrip |
| 459 // - HTNOWHERE: as the name implies. | 464 // - HTNOWHERE: as the name implies. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 526 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 522 // Create a browser view for chromeos. | 527 // Create a browser view for chromeos. |
| 523 BrowserView* view; | 528 BrowserView* view; |
| 524 if (browser->type() & Browser::TYPE_POPUP) | 529 if (browser->type() & Browser::TYPE_POPUP) |
| 525 view = new chromeos::PanelBrowserView(browser); | 530 view = new chromeos::PanelBrowserView(browser); |
| 526 else | 531 else |
| 527 view = new chromeos::BrowserView(browser); | 532 view = new chromeos::BrowserView(browser); |
| 528 BrowserFrame::Create(view, browser->profile()); | 533 BrowserFrame::Create(view, browser->profile()); |
| 529 return view; | 534 return view; |
| 530 } | 535 } |
| OLD | NEW |