| 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/gfx/canvas.h" | 10 #include "app/gfx/canvas.h" |
| 11 #include "app/menus/simple_menu_model.h" | 11 #include "app/menus/simple_menu_model.h" |
| 12 #include "app/theme_provider.h" | 12 #include "app/theme_provider.h" |
| 13 #include "chrome/app/chrome_dll_resource.h" | 13 #include "chrome/app/chrome_dll_resource.h" |
| 14 #include "chrome/browser/chromeos/app_launcher.h" | |
| 15 #include "chrome/browser/chromeos/compact_location_bar_host.h" | 14 #include "chrome/browser/chromeos/compact_location_bar_host.h" |
| 16 #include "chrome/browser/chromeos/compact_navigation_bar.h" | 15 #include "chrome/browser/chromeos/compact_navigation_bar.h" |
| 17 #include "chrome/browser/chromeos/frame/panel_browser_view.h" | 16 #include "chrome/browser/chromeos/frame/panel_browser_view.h" |
| 18 #include "chrome/browser/chromeos/status/browser_status_area_view.h" | 17 #include "chrome/browser/chromeos/status/browser_status_area_view.h" |
| 19 #include "chrome/browser/chromeos/status/network_menu_button.h" | 18 #include "chrome/browser/chromeos/status/network_menu_button.h" |
| 20 #include "chrome/browser/chromeos/status/status_area_button.h" | 19 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 21 #include "chrome/browser/chromeos/wm_ipc.h" | 20 #include "chrome/browser/chromeos/wm_ipc.h" |
| 22 #include "chrome/browser/view_ids.h" | 21 #include "chrome/browser/view_ids.h" |
| 22 #include "chrome/browser/views/app_launcher.h" |
| 23 #include "chrome/browser/views/frame/browser_extender.h" | 23 #include "chrome/browser/views/frame/browser_extender.h" |
| 24 #include "chrome/browser/views/frame/browser_frame_gtk.h" | 24 #include "chrome/browser/views/frame/browser_frame_gtk.h" |
| 25 #include "chrome/browser/views/frame/browser_view.h" | 25 #include "chrome/browser/views/frame/browser_view.h" |
| 26 #include "chrome/browser/views/frame/browser_view_layout.h" | 26 #include "chrome/browser/views/frame/browser_view_layout.h" |
| 27 #include "chrome/browser/views/tabs/tab.h" | 27 #include "chrome/browser/views/tabs/tab.h" |
| 28 #include "chrome/browser/views/tabs/tab_strip.h" | 28 #include "chrome/browser/views/tabs/tab_strip.h" |
| 29 #include "chrome/browser/views/toolbar_view.h" | 29 #include "chrome/browser/views/toolbar_view.h" |
| 30 #include "chrome/browser/views/toolbar_star_toggle.h" | 30 #include "chrome/browser/views/toolbar_star_toggle.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" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 chromeos::StatusAreaView* status_area_; | 331 chromeos::StatusAreaView* status_area_; |
| 332 views::View* compact_navigation_bar_; | 332 views::View* compact_navigation_bar_; |
| 333 views::View* spacer_; | 333 views::View* spacer_; |
| 334 views::View* otr_avatar_icon_; | 334 views::View* otr_avatar_icon_; |
| 335 | 335 |
| 336 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); | 336 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); |
| 337 }; | 337 }; |
| 338 | 338 |
| 339 BrowserView::BrowserView(Browser* browser) | 339 BrowserView::BrowserView(Browser* browser) |
| 340 : ::BrowserView(browser), | 340 : ::BrowserView(browser), |
| 341 main_menu_(NULL), | |
| 342 main_menu_button_(NULL), | 341 main_menu_button_(NULL), |
| 343 status_area_(NULL), | 342 status_area_(NULL), |
| 344 compact_navigation_bar_(NULL), | 343 compact_navigation_bar_(NULL), |
| 345 // Standard style is default. | 344 // Standard style is default. |
| 346 // TODO(oshima): Get this info from preference. | 345 // TODO(oshima): Get this info from preference. |
| 347 ui_style_(StandardStyle), | 346 ui_style_(StandardStyle), |
| 348 force_maximized_window_(false), | 347 force_maximized_window_(false), |
| 349 spacer_(NULL), | 348 spacer_(NULL), |
| 350 otr_avatar_icon_(new views::ImageView()) { | 349 otr_avatar_icon_(new views::ImageView()) { |
| 351 } | 350 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 if (is_compact_style()) | 450 if (is_compact_style()) |
| 452 compact_location_bar_host_->GetStarButton()->ShowStarBubble( | 451 compact_location_bar_host_->GetStarButton()->ShowStarBubble( |
| 453 url, !already_bookmarked); | 452 url, !already_bookmarked); |
| 454 else | 453 else |
| 455 ::BrowserView::ShowBookmarkBubble(url, already_bookmarked); | 454 ::BrowserView::ShowBookmarkBubble(url, already_bookmarked); |
| 456 } | 455 } |
| 457 | 456 |
| 458 // views::ButtonListener overrides. | 457 // views::ButtonListener overrides. |
| 459 void BrowserView::ButtonPressed(views::Button* sender, | 458 void BrowserView::ButtonPressed(views::Button* sender, |
| 460 const views::Event& event) { | 459 const views::Event& event) { |
| 461 if (!main_menu_.get()) { | 460 AppLauncher::Show(browser()); |
| 462 main_menu_.reset(new AppLauncher(browser())); | |
| 463 } | |
| 464 main_menu_->Show(); | |
| 465 } | 461 } |
| 466 | 462 |
| 467 // views::ContextMenuController overrides. | 463 // views::ContextMenuController overrides. |
| 468 void BrowserView::ShowContextMenu(views::View* source, | 464 void BrowserView::ShowContextMenu(views::View* source, |
| 469 const gfx::Point& p, | 465 const gfx::Point& p, |
| 470 bool is_mouse_gesture) { | 466 bool is_mouse_gesture) { |
| 471 // Only show context menu if point is in unobscured parts of browser, i.e. | 467 // Only show context menu if point is in unobscured parts of browser, i.e. |
| 472 // if NonClientHitTest returns : | 468 // if NonClientHitTest returns : |
| 473 // - HTCAPTION: in title bar or unobscured part of tabstrip | 469 // - HTCAPTION: in title bar or unobscured part of tabstrip |
| 474 // - HTNOWHERE: as the name implies. | 470 // - HTNOWHERE: as the name implies. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 532 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 537 // Create a browser view for chromeos. | 533 // Create a browser view for chromeos. |
| 538 BrowserView* view; | 534 BrowserView* view; |
| 539 if (browser->type() & Browser::TYPE_POPUP) | 535 if (browser->type() & Browser::TYPE_POPUP) |
| 540 view = new chromeos::PanelBrowserView(browser); | 536 view = new chromeos::PanelBrowserView(browser); |
| 541 else | 537 else |
| 542 view = new chromeos::BrowserView(browser); | 538 view = new chromeos::BrowserView(browser); |
| 543 BrowserFrame::Create(view, browser->profile()); | 539 BrowserFrame::Create(view, browser->profile()); |
| 544 return view; | 540 return view; |
| 545 } | 541 } |
| OLD | NEW |