diff options
31 files changed, 18 insertions, 1596 deletions
diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index 80c1ec5..034fae7 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -101,10 +101,9 @@ #define IDC_EXIT 34031 #define IDC_MOVE_TAB_NEXT 34032 #define IDC_MOVE_TAB_PREVIOUS 34033 -#define IDC_COMPACT_NAVBAR 34034 -#define IDC_TOGGLE_VERTICAL_TABS 34035 -#define IDC_EXPERIMENTAL 34036 -#define IDC_SEARCH 34037 +#define IDC_TOGGLE_VERTICAL_TABS 34034 +#define IDC_EXPERIMENTAL 34035 +#define IDC_SEARCH 34036 // Page-related commands #define IDC_BOOKMARK_PAGE 35000 diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index bed14b2..6aa22df 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8721,9 +8721,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Latvian keyboard layout </message> - <message name="IDS_COMPACT_NAVBAR" desc="The menu item on the app menu to toggle compact navigation bar"> - Compact Navigation Bar - </message> <message name="IDS_LOGIN_ERROR_AUTHENTICATING" desc="Couldn't log in because username / password invalid"> Invalid login </message> diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index a0de01a..1e30d39 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1424,12 +1424,6 @@ void Browser::ToggleFullscreenMode() { } #if defined(OS_CHROMEOS) -void Browser::ToggleCompactNavigationBar() { - UserMetrics::RecordAction(UserMetricsAction("ToggleCompactNavigationBar"), - profile_); - window_->ToggleCompactNavigationBar(); -} - void Browser::Search() { // If the NTP is showing, close it. if (StartsWithASCII(GetSelectedTabContents()->GetURL().spec(), @@ -2014,7 +2008,6 @@ void Browser::ExecuteCommandWithDisposition( case IDC_EXIT: Exit(); break; case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; #if defined(OS_CHROMEOS) - case IDC_COMPACT_NAVBAR: ToggleCompactNavigationBar(); break; case IDC_SEARCH: Search(); break; #endif @@ -3192,7 +3185,6 @@ void Browser::InitCommandState() { command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); #if defined(OS_CHROMEOS) - command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, true); command_updater_.UpdateCommandEnabled(IDC_SEARCH, true); command_updater_.UpdateCommandEnabled(IDC_SYSTEM_OPTIONS, true); command_updater_.UpdateCommandEnabled(IDC_INTERNET_OPTIONS, true); diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index 9c50dda..d2abb79 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -304,11 +304,6 @@ class BrowserWindow { // Shows the create web app shortcut dialog box. virtual void ShowCreateShortcutsDialog(TabContents* tab_contents) = 0; -#if defined(OS_CHROMEOS) - // Toggles compact navigation bar. - virtual void ToggleCompactNavigationBar() = 0; -#endif - // Clipboard commands applied to the whole browser window. virtual void Cut() = 0; virtual void Copy() = 0; diff --git a/chrome/browser/chromeos/compact_location_bar_host.cc b/chrome/browser/chromeos/compact_location_bar_host.cc deleted file mode 100644 index 7ed66e3..0000000 --- a/chrome/browser/chromeos/compact_location_bar_host.cc +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/compact_location_bar_host.h" - -#include <algorithm> - -#include "app/slide_animation.h" -#include "base/i18n/rtl.h" -#include "base/keyboard_codes.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/compact_location_bar_view.h" -#include "chrome/browser/find_bar_controller.h" -#include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/browser/view_ids.h" -#include "chrome/browser/views/bookmark_bar_view.h" -#include "chrome/browser/views/find_bar_view.h" -#include "chrome/browser/views/frame/browser_view.h" -#include "chrome/browser/views/tabs/base_tab_strip.h" -#include "views/controls/scrollbar/native_scroll_bar.h" -#include "views/focus/external_focus_tracker.h" -#include "views/focus/view_storage.h" -#include "views/widget/root_view.h" -#include "views/widget/widget.h" - -namespace chromeos { -const int kDefaultLocationBarWidth = 300; -const int kHideTimeoutInSeconds = 2; - -// An mouse event observer to detect a mouse click on -// BrowserView's content area and hide the location bar. -class MouseObserver : public MessageLoopForUI::Observer { - public: - MouseObserver(CompactLocationBarHost* host, ::BrowserView* view) - : host_(host), - browser_view_(view) { - top_level_window_ = browser_view_->GetWidget()->GetNativeView()->window; - } - - // MessageLoopForUI::Observer overrides. - virtual void WillProcessEvent(GdkEvent* event) {} - virtual void DidProcessEvent(GdkEvent* event) { - // Hide the location bar iff the mouse is pressed on the - // BrowserView's content area. - if (event->type == GDK_BUTTON_PRESS && - GDK_IS_WINDOW(event->any.window) && - top_level_window_ == gdk_window_get_toplevel(event->any.window) && - HitContentArea(event)) { - host_->Hide(true); - } - } - - private: - // Tests if the event occured on the content area, using - // root window's coordinates. - bool HitContentArea(GdkEvent* event) { - gfx::Point p(event->button.x_root, event->button.y_root); - // First, exclude the location bar as it's shown on top of - // content area. - if (HitOnScreen(host_->GetClbView(), p)) { - return false; - } - // Treat the bookmark as a content area when it in detached mode. - if (browser_view_->GetBookmarkBarView()->IsDetached() && - browser_view_->IsBookmarkBarVisible() && - HitOnScreen(browser_view_->GetBookmarkBarView(), p)) { - return true; - } - if (HitOnScreen(browser_view_->GetContentsView(), - p)) { - return true; - } - return false; - } - - // Tests if |p| in the root window's coordinate is within the |view|'s bound. - bool HitOnScreen(const views::View* view, const gfx::Point& p) { - gfx::Point origin(0, 0); - views::View::ConvertPointToScreen(view, &origin); - gfx::Rect new_bounds(origin, view->size()); - return new_bounds.Contains(p); - } - - CompactLocationBarHost* host_; - ::BrowserView* browser_view_; - GdkWindow* top_level_window_; - - DISALLOW_COPY_AND_ASSIGN(MouseObserver); -}; - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarHost, public: - -CompactLocationBarHost::CompactLocationBarHost(::BrowserView* browser_view) - : DropdownBarHost(browser_view), - current_tab_model_index_(-1) { - auto_hide_timer_.reset(new base::OneShotTimer<CompactLocationBarHost>()); - mouse_observer_.reset(new MouseObserver(this, browser_view)); - Init(new CompactLocationBarView(this)); -} - -CompactLocationBarHost::~CompactLocationBarHost() { - browser_view()->browser()->tabstrip_model()->RemoveObserver(this); - MessageLoopForUI::current()->RemoveObserver(mouse_observer_.get()); -} - -void CompactLocationBarHost::StartAutoHideTimer() { - if (!host()->IsVisible()) - return; - if (auto_hide_timer_->IsRunning()) { - // Restart the timer. - auto_hide_timer_->Reset(); - } else { - auto_hide_timer_->Start(base::TimeDelta::FromSeconds(kHideTimeoutInSeconds), - this, &CompactLocationBarHost::HideCallback); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarHost, views::AcceleratorTarget implementation: - -bool CompactLocationBarHost::AcceleratorPressed( - const views::Accelerator& accelerator) { - Hide(true); - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarHost, views::DropdownBarHost implementation: - -gfx::Rect CompactLocationBarHost::GetDialogPosition( - gfx::Rect avoid_overlapping_rect) { - DCHECK_GE(current_tab_model_index_, 0); - gfx::Rect new_pos = GetBoundsUnderTab(current_tab_model_index_); - - if (animation_offset() > 0) - new_pos.Offset(0, std::min(0, -animation_offset())); - return new_pos; -} - -void CompactLocationBarHost::SetDialogPosition(const gfx::Rect& new_pos, - bool no_redraw) { - if (new_pos.IsEmpty()) - return; - - // Make sure the window edges are clipped to just the visible region. We need - // to do this before changing position, so that when we animate the closure - // of it it doesn't look like the window crumbles into the toolbar. - UpdateWindowEdges(new_pos); - - // TODO(oshima): Animate the window clipping like find-bar. - SetWidgetPositionNative(new_pos, no_redraw); -} - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarHost, views::TabStripModelObserver implementation: - -void CompactLocationBarHost::TabInsertedAt(TabContents* contents, - int index, - bool foreground) { - Hide(false); - // TODO(oshima): Consult UX team if we should show the location bar. -} - -void CompactLocationBarHost::TabClosingAt(TabContents* contents, int index) { - if (IsCurrentTabIndex(index)) { - Hide(false); - } else { - // TODO(oshima): We need to relocate the compact navigation bar here, - // but the tabstrip does not have the ideal location yet - // because the tabs are animating at this time. Need to investigate - // the best way to handle this case. - } -} - -void CompactLocationBarHost::TabSelectedAt(TabContents* old_contents, - TabContents* new_contents, - int index, - bool user_gesture) { - if (user_gesture) { - // Show the compact location bar only when a user selected the tab. - Update(index, false, true); - } else { - Hide(false); - } -} - -void CompactLocationBarHost::TabMoved(TabContents* contents, - int from_index, - int to_index) { - Update(to_index, false, true); -} - -void CompactLocationBarHost::TabChangedAt(TabContents* contents, int index, - TabChangeType change_type) { - if (IsCurrentTabIndex(index) && IsVisible()) { - GetClbView()->Update(contents); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarHost public: - -gfx::Rect CompactLocationBarHost::GetBoundsUnderTab(int model_index) const { - // Get the position of the left-bottom corner of the tab on the - // widget. The widget of the tab is same as the widget of the - // BrowserView which is the parent of the host. - BaseTabStrip* tabstrip = browser_view()->tabstrip(); - gfx::Rect bounds = - tabstrip->ideal_bounds(tabstrip->ModelIndexToTabIndex(model_index)); - gfx::Rect navbar_bounds(gfx::Point(bounds.x(), bounds.height()), - view()->GetPreferredSize()); - - // For RTL case x() defines tab right corner. - if (base::i18n::IsRTL()) - navbar_bounds.set_x(navbar_bounds.x() + bounds.width()); - navbar_bounds.set_x(navbar_bounds.x() + tabstrip->x()); - navbar_bounds.set_y(navbar_bounds.y() + tabstrip->y()); - - // The compact location bar must be smaller than browser_width. - int width = std::min(browser_view()->width(), - view()->GetPreferredSize().width()); - - // Try to center around the tab. - navbar_bounds.set_x(browser_view()->MirroredXCoordinateInsideView( - navbar_bounds.x()) - ((width - bounds.width()) / 2)); - - if (browser_view()->IsBookmarkBarVisible() && - !browser_view()->GetBookmarkBarView()->IsDetached()) { - // Adjust the location to create the illusion that the compact location bar - // is a part of boolmark bar. - // TODO(oshima): compact location bar does not have right background - // image yet, so -2 is tentative. Fix this once UI is settled. - navbar_bounds.set_y( - browser_view()->GetBookmarkBarView()->bounds().bottom() - 2); - } - return navbar_bounds.AdjustToFit(browser_view()->bounds()); -} - -void CompactLocationBarHost::Update(int model_index, - bool animate_x, - bool select_all) { - DCHECK_GE(model_index, 0); - if (IsCurrentTabIndex(model_index) && IsVisible()) { - return; - } - current_tab_model_index_ = model_index; - // Don't aminate if the bar is already shown. - bool animate = !animation()->IsShowing(); - Hide(false); - GetClbView()->Update(browser_view()->browser()->GetSelectedTabContents()); - GetClbView()->SetFocusAndSelection(select_all); - Show(animate && animate_x); -} - -void CompactLocationBarHost::CancelAutoHideTimer() { - auto_hide_timer_->Stop(); -} - -void CompactLocationBarHost::SetEnabled(bool enabled) { - if (enabled) { - browser_view()->browser()->tabstrip_model()->AddObserver(this); - } else { - browser_view()->browser()->tabstrip_model()->RemoveObserver(this); - } -} - -void CompactLocationBarHost::Show(bool a) { - MessageLoopForUI::current()->AddObserver(mouse_observer_.get()); - DropdownBarHost::Show(a); -} - -void CompactLocationBarHost::Hide(bool a) { - MessageLoopForUI::current()->RemoveObserver(mouse_observer_.get()); - DropdownBarHost::Hide(a); -} - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarHost private: - -CompactLocationBarView* CompactLocationBarHost::GetClbView() { - return static_cast<CompactLocationBarView*>(view()); -} - -bool CompactLocationBarHost::IsCurrentTabIndex(int index) { - return current_tab_model_index_ == index; -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/compact_location_bar_host.h b/chrome/browser/chromeos/compact_location_bar_host.h deleted file mode 100644 index 5e399a8..0000000 --- a/chrome/browser/chromeos/compact_location_bar_host.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_HOST_H_ -#define CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_HOST_H_ - -#include "app/animation.h" -#include "base/timer.h" -#include "chrome/browser/tabs/tab_strip_model.h" -#include "chrome/browser/views/dropdown_bar_host.h" -#include "gfx/native_widget_types.h" -#include "gfx/rect.h" -#include "views/controls/textfield/textfield.h" - -class BrowserView; -class TabContents; -class Tab; - -namespace chromeos { - -class CompactLocationBarView; -class MouseObserver; - -//////////////////////////////////////////////////////////////////////////////// -// -// The CompactLocationBarHost implements the container window for the -// floating location bar. It uses the appropriate implementation from -// compact_location_bar_host_gtk.cc to draw its content and is -// responsible for showing, hiding, closing, and moving the window. -// -// There is one CompactLocationBarHost per BrowserView, and its state -// is updated whenever the selected Tab is changed. The -// CompactLocationBarHost is created when the BrowserView is attached -// to the frame's Widget for the first time, and enabled/disabled -// when the compact navigation bar is toggled. -// -//////////////////////////////////////////////////////////////////////////////// -class CompactLocationBarHost : public DropdownBarHost, - public TabStripModelObserver { - public: - explicit CompactLocationBarHost(::BrowserView* browser_view); - virtual ~CompactLocationBarHost(); - - // Returns the bounds to locale the compact location bar under the tab. - gfx::Rect GetBoundsUnderTab(int model_index) const; - - // Updates the content and the position of the compact location bar. - // |model_index| is the index of the tab the compact location bar - // will be attached to and |animate| specifies if the location bar - // should animate when shown. - void Update(int model_index, bool animate, bool select_all); - - // (Re)Starts the popup timer that hides the popup after X seconds. - void StartAutoHideTimer(); - - // Cancels the popup timer. - void CancelAutoHideTimer(); - - // Enable/disable the compact location bar. - void SetEnabled(bool enabled); - - // Overridden from DropdownBarhost. - virtual void Show(bool animate); - virtual void Hide(bool animate); - - // Overridden from views::AcceleratorTarget in DropdownBarHost class. - virtual bool AcceleratorPressed(const views::Accelerator& accelerator); - - // Overridden from DropdownBarHost class. - virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect); - virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw); - - // Overriden from TabStripModelObserver class. - virtual void TabInsertedAt(TabContents* contents, - int index, - bool foreground); - virtual void TabClosingAt(TabContents* contents, int index); - virtual void TabSelectedAt(TabContents* old_contents, - TabContents* new_contents, - int index, - bool user_gesture); - virtual void TabMoved(TabContents* contents, - int from_index, - int to_index); - virtual void TabChangedAt(TabContents* contents, int index, - TabChangeType change_type); - - private: - friend class MouseObserver; - friend class CompactLocationBarHostTest; - - void HideCallback() { - Hide(true); - } - - // Returns CompactLocationBarView. - CompactLocationBarView* GetClbView(); - - bool IsCurrentTabIndex(int index); - - // The index of the tab, in terms of the model, that the compact location bar - // is attached to. - int current_tab_model_index_; - - scoped_ptr<base::OneShotTimer<CompactLocationBarHost> > auto_hide_timer_; - - scoped_ptr<MouseObserver> mouse_observer_; - - DISALLOW_COPY_AND_ASSIGN(CompactLocationBarHost); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_HOST_H_ diff --git a/chrome/browser/chromeos/compact_location_bar_view.cc b/chrome/browser/chromeos/compact_location_bar_view.cc deleted file mode 100644 index 5456504..0000000 --- a/chrome/browser/chromeos/compact_location_bar_view.cc +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/compact_location_bar_view.h" - -#include <gtk/gtk.h> -#include <algorithm> - -#include "app/l10n_util.h" -#include "app/resource_bundle.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/bookmarks/bookmark_model.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" -#include "chrome/browser/browser_list.h" -#include "chrome/browser/browser_theme_provider.h" -#include "chrome/browser/chromeos/compact_location_bar_host.h" -#include "chrome/browser/metrics/user_metrics.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/view_ids.h" -#include "chrome/browser/views/browser_actions_container.h" -#include "chrome/browser/views/event_utils.h" -#include "chrome/browser/views/frame/browser_view.h" -#include "gfx/canvas.h" -#include "gfx/point.h" -#include "grit/chromium_strings.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "views/background.h" -#include "views/controls/button/image_button.h" -#include "views/controls/native/native_view_host.h" -#include "views/widget/widget.h" -#include "views/window/window.h" - -namespace chromeos { -const int kDefaultLocationEntryWidth = 250; -const int kCompactLocationLeftMargin = 5; -const int kCompactLocationRightMargin = 10; -const int kEntryLeftMargin = 2; -// TODO(oshima): ToolbarView gets this from background image's height; -// Find out the right way, value for compact location bar. -const int kDefaultLocationBarHeight = 34; -const int kWidgetsSeparatorWidth = 2; - -CompactLocationBarView::CompactLocationBarView(CompactLocationBarHost* host) - : DropdownBarView(host), - reload_(NULL), - browser_actions_(NULL) { - SetFocusable(true); -} - -CompactLocationBarView::~CompactLocationBarView() { -} - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarView public: - -void CompactLocationBarView::SetFocusAndSelection(bool select_all) { - location_entry_->SetFocus(); - if (select_all) - location_entry_->SelectAll(true); -} - -void CompactLocationBarView::Update(const TabContents* contents) { - location_entry_->Update(contents); - browser_actions_->RefreshBrowserActionViews(); -} - - -//////////////////////////////////////////////////////////////////////////////// -// CompactLocationBarView private: - -Browser* CompactLocationBarView::browser() const { - return host()->browser_view()->browser(); -} - -void CompactLocationBarView::Init() { - ThemeProvider* tp = browser()->profile()->GetThemeProvider(); - SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND); - SkBitmap* background = tp->GetBitmapNamed(IDR_THEME_BUTTON_BACKGROUND); - - // Reload button. - reload_ = new views::ImageButton(this); - reload_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, - views::ImageButton::ALIGN_MIDDLE); - reload_->set_tag(IDC_RELOAD); - reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD)); - reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD)); - reload_->SetID(VIEW_ID_RELOAD_BUTTON); - - reload_->SetImage(views::CustomButton::BS_NORMAL, - tp->GetBitmapNamed(IDR_RELOAD)); - reload_->SetImage(views::CustomButton::BS_HOT, - tp->GetBitmapNamed(IDR_RELOAD_H)); - reload_->SetImage(views::CustomButton::BS_PUSHED, - tp->GetBitmapNamed(IDR_RELOAD_P)); - reload_->SetBackground(color, background, - tp->GetBitmapNamed(IDR_BUTTON_MASK)); - - AddChildView(reload_); - - // Location bar. - location_entry_.reset(new AutocompleteEditViewGtk( - this, browser()->toolbar_model(), browser()->profile(), - browser()->command_updater(), false, this)); - - location_entry_->Init(); - location_entry_->Update(browser()->GetSelectedTabContents()); - gtk_widget_show_all(location_entry_->GetNativeView()); - gtk_widget_hide(location_entry_->GetNativeView()); - - location_entry_view_ = new views::NativeViewHost; - AddChildView(location_entry_view_); - location_entry_view_->set_focus_view(this); - location_entry_view_->Attach(location_entry_->GetNativeView()); - - location_entry_->Update(browser()->GetSelectedTabContents()); - - // Note: we tell the BrowserActionsContainer not to save its size because - // the main container is part of the ToolbarView, and we don't want them - // fighting. See http://code.google.com/p/chromium/issues/detail?id=38992 - browser_actions_ = new BrowserActionsContainer(browser(), this, false); - AddChildView(browser_actions_); -} - -//////////////////////////////////////////////////////////////////////////////// -// views::View overrides: - -gfx::Size CompactLocationBarView::GetPreferredSize() { - if (!reload_) - return gfx::Size(); // Not initialized yet, do nothing. - - gfx::Size reload_size = reload_->GetPreferredSize(); - gfx::Size location_size = location_entry_view_->GetPreferredSize(); - gfx::Size ba_size = browser_actions_->GetPreferredSize(); - int width = kCompactLocationLeftMargin + reload_size.width() + - std::max(kDefaultLocationEntryWidth, - location_entry_view_->GetPreferredSize().width()) + - ba_size.width() + - kCompactLocationRightMargin; - return gfx::Size(width, kDefaultLocationBarHeight); -} - -void CompactLocationBarView::Layout() { - if (!reload_) - return; // Not initialized yet, do nothing. - - int cur_x = kCompactLocationLeftMargin; - - gfx::Size reload_size = reload_->GetPreferredSize(); - int reload_y = (height() - reload_size.height()) / 2; - reload_->SetBounds(cur_x, reload_y, - reload_size.width(), reload_size.height()); - cur_x += reload_size.width(); - - gfx::Size ba_size = browser_actions_->GetPreferredSize(); - int ba_y = (height() - ba_size.height()) / 2; - browser_actions_->SetBounds( - width() - ba_size.width(), ba_y, ba_size.width(), ba_size.height()); - int location_entry_width = browser_actions_->x() - cur_x; - if (ba_size.IsEmpty()) { - // BrowserActionsContainer has its own margin on right. - // Use the our margin when if the browser action is empty. - location_entry_width -= kCompactLocationRightMargin; - } - - // The location bar gets the rest of the space in the middle. - location_entry_view_->SetBounds(cur_x, 0, location_entry_width, height()); -} - -void CompactLocationBarView::Paint(gfx::Canvas* canvas) { - gfx::Rect lb = GetLocalBounds(true); - ThemeProvider* tp = GetThemeProvider(); - gfx::Rect bounds; - host()->GetThemePosition(&bounds); - canvas->TileImageInt(*tp->GetBitmapNamed(IDR_THEME_TOOLBAR), - bounds.x(), bounds.y(), 0, 0, lb.width(), lb.height()); - View::Paint(canvas); -} - -void CompactLocationBarView::ViewHierarchyChanged(bool is_add, View* parent, - View* child) { - if (is_add && child == this) - Init(); -} - -void CompactLocationBarView::Focus() { - location_entry_->SetFocus(); -} - -//////////////////////////////////////////////////////////////////////////////// -// views::ButtonListener overrides: - -void CompactLocationBarView::ButtonPressed(views::Button* sender, - const views::Event& event) { - int id = sender->tag(); - int flags = sender->mouse_event_flags(); - // Shift-clicking or ctrl-clicking the reload button means we should - // ignore any cached content. - // TODO(avayvod): eliminate duplication of this logic in - // CompactLocationBarView. - if (id == IDC_RELOAD && (event.IsShiftDown() || event.IsControlDown())) { - id = IDC_RELOAD_IGNORING_CACHE; - // Mask off shift/ctrl so they aren't interpreted as affecting the - // disposition below. - flags &= ~(views::Event::EF_SHIFT_DOWN | views::Event::EF_CONTROL_DOWN); - } - browser()->ExecuteCommandWithDisposition( - id, event_utils::DispositionFromEventFlags(flags)); -} - -//////////////////////////////////////////////////////////////////////////////// -// AutocompleteEditController overrides: - -void CompactLocationBarView::OnAutocompleteAccept( - const GURL& url, - WindowOpenDisposition disposition, - PageTransition::Type transition, - const GURL& alternate_nav_url) { - browser()->OpenURL(url, GURL(), disposition, transition); - clb_host()->StartAutoHideTimer(); -} - -void CompactLocationBarView::OnChanged() { - // Other one does "DoLayout" here. -} - -void CompactLocationBarView::OnKillFocus() { - host()->UnregisterAccelerators(); -} - -void CompactLocationBarView::OnSetFocus() { - views::FocusManager* focus_manager = GetFocusManager(); - if (!focus_manager) { - NOTREACHED(); - return; - } - focus_manager->SetFocusedView(this); - host()->RegisterAccelerators(); -} - -void CompactLocationBarView::OnInputInProgress(bool in_progress) { -} - -SkBitmap CompactLocationBarView::GetFavIcon() const { - return SkBitmap(); -} - -std::wstring CompactLocationBarView::GetTitle() const { - return std::wstring(); -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/compact_location_bar_view.h b/chrome/browser/chromeos/compact_location_bar_view.h deleted file mode 100644 index a3c750f..0000000 --- a/chrome/browser/chromeos/compact_location_bar_view.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ -#define CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ - -#include "base/basictypes.h" -#include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/chromeos/compact_location_bar_host.h" -#include "chrome/browser/views/dropdown_bar_view.h" -#include "views/controls/button/button.h" -#include "views/view.h" - -class AutocompleteEditViewGtk; -class Browser; -class BrowserActionsContainer; -class BrowserView; -class Tab; -class TabContents; -class TabStrip; - -namespace views { -class ImageButton; -class NativeViewHost; -} // namespace views - -namespace chromeos { - -// CompactLocationBarView is a version of location bar that is shown under -// a tab for short priod of used when Chrome is in the compact -// navigation bar mode. -class CompactLocationBarView : public DropdownBarView, - public views::ButtonListener, - public AutocompleteEditController { - public: - explicit CompactLocationBarView(CompactLocationBarHost* host); - ~CompactLocationBarView(); - - // Claims focus for the text field and optionally selects its contents. - virtual void SetFocusAndSelection(bool select_all); - - void Update(const TabContents* contents); - - private: - Browser* browser() const; - - // Called when the view is added to the tree to initialize the - // CompactLocationBarView. - void Init(); - - // Overridden from views::View. - virtual gfx::Size GetPreferredSize(); - virtual void Layout(); - virtual void Paint(gfx::Canvas* canvas); - virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child); - virtual void Focus(); - // No focus border for the location bar, the caret is enough. - virtual void PaintFocusBorder(gfx::Canvas* canvas) { } - - // Overridden from views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event); - - // AutocompleteEditController implementation. - virtual void OnAutocompleteAccept(const GURL& url, - WindowOpenDisposition disposition, - PageTransition::Type transition, - const GURL& alternate_nav_url); - virtual void OnChanged(); - virtual void OnKillFocus(); - virtual void OnSetFocus(); - virtual void OnInputInProgress(bool in_progress); - virtual SkBitmap GetFavIcon() const; - virtual std::wstring GetTitle() const; - - CompactLocationBarHost* clb_host() { - return static_cast<CompactLocationBarHost*>(host()); - } - - views::ImageButton* reload_; - scoped_ptr<AutocompleteEditViewGtk> location_entry_; - views::NativeViewHost* location_entry_view_; - BrowserActionsContainer* browser_actions_; - - DISALLOW_COPY_AND_ASSIGN(CompactLocationBarView); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ diff --git a/chrome/browser/chromeos/compact_navigation_bar.cc b/chrome/browser/chromeos/compact_navigation_bar.cc deleted file mode 100644 index ef0a394..0000000 --- a/chrome/browser/chromeos/compact_navigation_bar.cc +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/compact_navigation_bar.h" - -#include "app/l10n_util.h" -#include "app/resource_bundle.h" -#include "app/theme_provider.h" -#include "base/logging.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/back_forward_menu_model.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/browser_theme_provider.h" -#include "chrome/browser/browser_window.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/view_ids.h" -#include "chrome/browser/views/event_utils.h" -#include "chrome/browser/views/frame/browser_view.h" -#include "chrome/browser/views/theme_background.h" -#include "gfx/canvas.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "views/controls/button/button_dropdown.h" -#include "views/controls/button/image_button.h" -#include "views/controls/image_view.h" -#include "views/controls/native/native_view_host.h" - -namespace chromeos { - -// Padding inside each button around the image. -static const int kInnerPadding = 1; - -// Spacing between buttons (excluding left/right most margin) -static const int kHorizMargin = 3; - -// Left side margin of the back button to align with the main menu. -static const int kBackButtonLeftMargin = 10; - -// Right side margin of the forward button to align with the main menu. -static const int kForwardButtonRightMargin = 1; - -// Preferred height. -static const int kPreferredHeight = 25; - -//////////////////////////////////////////////////////////////////////////////// -// CompactNavigationBar public: - -CompactNavigationBar::CompactNavigationBar(::BrowserView* browser_view) - : browser_view_(browser_view), - initialized_(false) { -} - -CompactNavigationBar::~CompactNavigationBar() { -} - -void CompactNavigationBar::Init() { - DCHECK(!initialized_); - initialized_ = true; - Browser* browser = browser_view_->browser(); - browser->command_updater()->AddCommandObserver(IDC_BACK, this); - browser->command_updater()->AddCommandObserver(IDC_FORWARD, this); - - back_menu_model_.reset(new BackForwardMenuModel( - browser, BackForwardMenuModel::BACKWARD_MENU)); - forward_menu_model_.reset(new BackForwardMenuModel( - browser, BackForwardMenuModel::FORWARD_MENU)); - - ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); - - back_ = new views::ButtonDropDown(this, back_menu_model_.get()); - back_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN | - views::Event::EF_MIDDLE_BUTTON_DOWN); - back_->set_tag(IDC_BACK); - back_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_BACK)); - back_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BACK)); - back_->SetImage(views::CustomButton::BS_NORMAL, - resource_bundle.GetBitmapNamed(IDR_COMPACTNAV_BACK)); - back_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, - views::ImageButton::ALIGN_MIDDLE); - - AddChildView(back_); - - bf_separator_ = new views::ImageView; - bf_separator_->SetImage( - resource_bundle.GetBitmapNamed(IDR_COMPACTNAV_SEPARATOR)); - AddChildView(bf_separator_); - - forward_ = new views::ButtonDropDown(this, forward_menu_model_.get()); - forward_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN | - views::Event::EF_MIDDLE_BUTTON_DOWN); - forward_->set_tag(IDC_FORWARD); - forward_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_FORWARD)); - forward_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_FORWARD)); - forward_->SetImage(views::CustomButton::BS_NORMAL, - resource_bundle.GetBitmapNamed(IDR_COMPACTNAV_FORWARD)); - forward_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, - views::ImageButton::ALIGN_MIDDLE); - AddChildView(forward_); - - set_background(new ThemeBackground(browser_view_)); -} - -gfx::Size CompactNavigationBar::GetPreferredSize() { - int width = kBackButtonLeftMargin; - width += back_->GetPreferredSize().width() + kInnerPadding * 2; - width += kHorizMargin; - width += bf_separator_->GetPreferredSize().width(); - width += kHorizMargin; - width += forward_->GetPreferredSize().width() + kInnerPadding * 2; - width += kForwardButtonRightMargin; - return gfx::Size(width, kPreferredHeight); -} - -void CompactNavigationBar::Layout() { - if (!initialized_) - return; - - // Layout forward/back buttons after entry views as follows: - // [Back]|[Forward] - int curx = kBackButtonLeftMargin; - // "Back | Forward" section. - gfx::Size button_size = back_->GetPreferredSize(); - button_size.set_width(button_size.width() + kInnerPadding * 2); - back_->SetBounds(curx, 0, button_size.width(), height()); - curx += button_size.width() + kHorizMargin; - - button_size = bf_separator_->GetPreferredSize(); - bf_separator_->SetBounds(curx, 0, button_size.width(), height()); - curx += button_size.width() + kHorizMargin; - - button_size = forward_->GetPreferredSize(); - button_size.set_width(button_size.width() + kInnerPadding * 2); - forward_->SetBounds(curx, 0, button_size.width(), height()); -} - -void CompactNavigationBar::Paint(gfx::Canvas* canvas) { - PaintBackground(canvas); -} - -//////////////////////////////////////////////////////////////////////////////// -// views::ButtonListener implementation. - -void CompactNavigationBar::ButtonPressed( - views::Button* sender, const views::Event& event) { - browser_view_->browser()->ExecuteCommandWithDisposition( - sender->tag(), - event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); -} - -//////////////////////////////////////////////////////////////////////////////// -// CommandUpdater::CommandObserver implementation. -void CompactNavigationBar::EnabledStateChangedForCommand(int id, bool enabled) { - switch (id) { - case IDC_BACK: - back_->SetEnabled(enabled); - break; - case IDC_FORWARD: - forward_->SetEnabled(enabled); - break; - } -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/compact_navigation_bar.h b/chrome/browser/chromeos/compact_navigation_bar.h deleted file mode 100644 index 3b15826..0000000 --- a/chrome/browser/chromeos/compact_navigation_bar.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ -#define CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ - -#include "base/basictypes.h" -#include "base/scoped_ptr.h" -#include "chrome/browser/command_updater.h" -#include "views/controls/button/button.h" -#include "views/view.h" - -class AutocompleteEditViewGtk; -class BackForwardMenuModel; -class BrowserView; - -namespace views { -class ImageButton; -class ImageView; -class NativeViewHost; -} - -namespace chromeos { - -// This class provides a small navigation bar that includes back, forward, and -// a small text entry box. -class CompactNavigationBar : public views::View, - public views::ButtonListener, - public CommandUpdater::CommandObserver { - public: - explicit CompactNavigationBar(::BrowserView* browser_view); - virtual ~CompactNavigationBar(); - - // Must be called before anything else, but after adding this view to the - // widget. - void Init(); - - // views::View overrides. - virtual gfx::Size GetPreferredSize(); - virtual void Layout(); - virtual void Paint(gfx::Canvas* canvas); - - private: - // views::ButtonListener implementation. - virtual void ButtonPressed(views::Button* sender, const views::Event& event); - - // CommandUpdater::CommandObserver implementation. - virtual void EnabledStateChangedForCommand(int id, bool enabled); - - ::BrowserView* browser_view_; - - bool initialized_; - - views::ImageButton* back_; - views::ImageView* bf_separator_; - views::ImageButton* forward_; - - // History menu for back and forward buttons. - scoped_ptr<BackForwardMenuModel> back_menu_model_; - scoped_ptr<BackForwardMenuModel> forward_menu_model_; - - DISALLOW_COPY_AND_ASSIGN(CompactNavigationBar); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc index bdc2831..a165fde 100644 --- a/chrome/browser/chromeos/frame/browser_view.cc +++ b/chrome/browser/chromeos/frame/browser_view.cc @@ -9,21 +9,17 @@ #include <vector> #include "app/menus/simple_menu_model.h" -#include "app/theme_provider.h" #include "base/command_line.h" #include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/chromeos/compact_location_bar_host.h" -#include "chrome/browser/chromeos/compact_navigation_bar.h" #include "chrome/browser/chromeos/frame/panel_browser_view.h" #include "chrome/browser/chromeos/options/language_config_view.h" -#include "chrome/browser/chromeos/status/browser_status_area_view.h" +#include "chrome/browser/chromeos/status/status_area_view.h" #include "chrome/browser/chromeos/status/language_menu_button.h" #include "chrome/browser/chromeos/status/network_menu_button.h" #include "chrome/browser/chromeos/status/status_area_button.h" #include "chrome/browser/chromeos/view_ids.h" #include "chrome/browser/chromeos/wm_ipc.h" #include "chrome/browser/views/app_launcher.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_frame_gtk.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/frame/browser_view_layout.h" @@ -34,7 +30,6 @@ #include "chrome/common/chrome_switches.h" #include "gfx/canvas.h" #include "grit/generated_resources.h" -#include "grit/theme_resources.h" #include "third_party/cros/chromeos_wm_ipc_enums.h" #include "views/controls/button/button.h" #include "views/controls/button/image_button.h" @@ -55,75 +50,12 @@ const int kOTRBottomSpacing = 2; // it on the left, and between it and the tabstrip on the right). const int kOTRSideSpacing = 2; -// The size of the space between the content area and the tabstrip that is -// inserted in compact nvaigation bar mode. -const int kCompactNavbarSpaceHeight = 3; - // The padding of the app launcher to the left side of the border. const int kAppLauncherLeftPadding = 5; // Amount to offset the toolbar by when vertical tabs are enabled. const int kVerticalTabStripToolbarOffset = 2; -// A space we insert between the tabstrip and the content in -// Compact mode. -class Spacer : public views::View { - SkBitmap* background_; - public: - explicit Spacer(SkBitmap* bitmap) : background_(bitmap) {} - - void Paint(gfx::Canvas* canvas) { - canvas->TileImageInt(*background_, 0, 0, width(), height()); - } - - private: - DISALLOW_COPY_AND_ASSIGN(Spacer); -}; - -// TODO(sky): wire this back up. -/* -// A chromeos implementation of Tab that shows the compact location bar. -class ChromeosTab : public Tab { - public: - ChromeosTab(TabStrip* tab_strip, chromeos::BrowserView* browser_view) - : Tab(tab_strip), - browser_view_(browser_view) { - } - virtual ~ChromeosTab() {} - - // Overridden from views::View. - virtual void OnMouseEntered(const views::MouseEvent& event) { - TabRenderer::OnMouseEntered(event); - browser_view_->ShowCompactLocationBarUnderSelectedTab(true); - } - - private: - chromeos::BrowserView* browser_view_; - - DISALLOW_COPY_AND_ASSIGN(ChromeosTab); -}; - -// A Tabstrip that uses ChromeosTab as a Tab implementation. -class ChromeosTabStrip : public TabStrip { - public: - ChromeosTabStrip(TabStripModel* model, chromeos::BrowserView* browser_view) - : TabStrip(model), browser_view_(browser_view) { - } - virtual ~ChromeosTabStrip() {} - - protected: - // Overridden from TabStrip. - virtual Tab* CreateTab() { - return new ChromeosTab(this, browser_view_); - } - - private: - chromeos::BrowserView* browser_view_; - - DISALLOW_COPY_AND_ASSIGN(ChromeosTabStrip); -}; -*/ - } // namespace namespace chromeos { @@ -142,9 +74,7 @@ class BrowserViewLayout : public ::BrowserViewLayout { // BrowserViewLayout overrides: void Installed(views::View* host) { - compact_navigation_bar_ = NULL; status_area_ = NULL; - spacer_ = NULL; ::BrowserViewLayout::Installed(host); } @@ -152,15 +82,9 @@ class BrowserViewLayout : public ::BrowserViewLayout { views::View* view) { ::BrowserViewLayout::ViewAdded(host, view); switch (view->GetID()) { - case VIEW_ID_SPACER: - spacer_ = view; - break; case VIEW_ID_STATUS_AREA: status_area_ = static_cast<chromeos::StatusAreaView*>(view); break; - case VIEW_ID_COMPACT_NAV_BAR: - compact_navigation_bar_ = view; - break; case VIEW_ID_OTR_AVATAR: otr_avatar_icon_ = view; break; @@ -172,7 +96,6 @@ class BrowserViewLayout : public ::BrowserViewLayout { // area. See Layout virtual int LayoutTabStrip() { if (browser_view_->IsFullscreen() || !browser_view_->IsTabStripVisible()) { - compact_navigation_bar_->SetVisible(false); status_area_->SetVisible(false); otr_avatar_icon_->SetVisible(false); tabstrip_->SetVisible(false); @@ -230,13 +153,6 @@ class BrowserViewLayout : public ::BrowserViewLayout { if (status_area_->HitTest(point_in_status_area_coords)) return true; - if (compact_navigation_bar_->IsVisible()) { - gfx::Point point_in_cnb_coords(point); - views::View::ConvertPointToView(browser_view_, - compact_navigation_bar_, - &point_in_cnb_coords); - return compact_navigation_bar_->HitTest(point_in_cnb_coords); - } return false; } @@ -246,13 +162,9 @@ class BrowserViewLayout : public ::BrowserViewLayout { if (bounds.IsEmpty()) return 0; - compact_navigation_bar_->SetVisible(false); - compact_navigation_bar_->SetBounds(0, 0, 0, 0); - spacer_->SetVisible(false); tabstrip_->SetVisible(true); otr_avatar_icon_->SetVisible(browser_view_->ShouldShowOffTheRecordAvatar()); status_area_->SetVisible(true); - status_area_->Update(); gfx::Size status_size = status_area_->GetPreferredSize(); int status_height = status_size.height(); @@ -302,35 +214,18 @@ class BrowserViewLayout : public ::BrowserViewLayout { } // Layouts components in the title bar area (given by - // |bounds|). These include the main menu, the compact navigation - // buttons (in compact navbar mode), the otr avatar icon (in + // |bounds|). These include the main menu, the otr avatar icon (in // incognito window), the tabstrip and the the status area. int LayoutTitlebarComponents(const gfx::Rect& bounds) { if (bounds.IsEmpty()) { return 0; } - compact_navigation_bar_->SetVisible( - chromeos_browser_view()->is_compact_style()); tabstrip_->SetVisible(true); otr_avatar_icon_->SetVisible(browser_view_->ShouldShowOffTheRecordAvatar()); status_area_->SetVisible(true); int bottom = bounds.bottom(); - /* TODO(oshima): - * Disabling the ability to update location bar on re-layout bacause - * tabstrip state may not be in sync with the browser's state when - * new tab is added. We should decide when we know more about this - * feature. May be we should simply hide the location? - * Filed a bug: http://crbug.com/30612. - if (compact_navigation_bar_->IsVisible()) { - // Update the size and location of the compact location bar. - int index = browser_view()->browser()->selected_index(); - compact_location_bar_host_->Update(index, false, true); - } - */ - - status_area_->Update(); // Layout status area after tab strip. gfx::Size status_size = status_area_->GetPreferredSize(); status_area_->SetBounds(bounds.x() + bounds.width() - status_size.width(), @@ -339,36 +234,15 @@ class BrowserViewLayout : public ::BrowserViewLayout { LayoutOTRAvatar(bounds); int curx = bounds.x(); - - if (compact_navigation_bar_->IsVisible()) { - gfx::Size cnb_size = compact_navigation_bar_->GetPreferredSize(); - // Adjust the size of the compact nativation bar to avoid creating - // a fixed widget with its own gdk window. AutocompleteEditView - // expects the parent view to be transparent, but a fixed with - // its own window is not. - gfx::Rect cnb_bounds(curx, bounds.y(), cnb_size.width(), bounds.height()); - compact_navigation_bar_->SetBounds( - cnb_bounds.Intersect(browser_view_->GetVisibleBounds())); - curx += cnb_bounds.width(); - - spacer_->SetVisible(true); - spacer_->SetBounds(0, bottom, browser_view_->width(), - kCompactNavbarSpaceHeight); - bottom += kCompactNavbarSpaceHeight; - } else { - compact_navigation_bar_->SetBounds(curx, bounds.y(), 0, 0); - spacer_->SetVisible(false); - } int remaining_width = std::max( 0, // In case there is no space left. - otr_avatar_icon_->bounds().x() - - compact_navigation_bar_->bounds().right()); + otr_avatar_icon_->bounds().x() - curx); + tabstrip_->SetBounds(curx, bounds.y(), remaining_width, bounds.height()); gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds(); tabstrip_->SetBackgroundOffset( - gfx::Point(curx - toolbar_bounds.x(), - bounds.y())); + gfx::Point(curx - toolbar_bounds.x(), bounds.y())); return bottom; } @@ -389,8 +263,6 @@ class BrowserViewLayout : public ::BrowserViewLayout { chromeos::StatusAreaView* status_area_; - views::View* compact_navigation_bar_; - views::View* spacer_; views::View* otr_avatar_icon_; DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); @@ -399,12 +271,7 @@ class BrowserViewLayout : public ::BrowserViewLayout { BrowserView::BrowserView(Browser* browser) : ::BrowserView(browser), status_area_(NULL), - compact_navigation_bar_(NULL), - // Standard style is default. - // TODO(oshima): Get this info from preference. - ui_style_(StandardStyle), force_maximized_window_(false), - spacer_(NULL), otr_avatar_icon_(new views::ImageView()) { } @@ -416,28 +283,10 @@ BrowserView::~BrowserView() { void BrowserView::Init() { ::BrowserView::Init(); - ThemeProvider* theme_provider = - frame()->GetThemeProviderForFrame(); - - compact_location_bar_host_.reset( - new chromeos::CompactLocationBarHost(this)); - compact_navigation_bar_ = - new chromeos::CompactNavigationBar(this); - compact_navigation_bar_->SetID(VIEW_ID_COMPACT_NAV_BAR); - AddChildView(compact_navigation_bar_); - compact_navigation_bar_->Init(); - status_area_ = new BrowserStatusAreaView(this); + status_area_ = new StatusAreaView(this); status_area_->SetID(VIEW_ID_STATUS_AREA); AddChildView(status_area_); status_area_->Init(); - ToolbarView* toolbar_view = GetToolbarView(); - toolbar_view->SetAppMenuModel(status_area_->CreateAppMenuModel(toolbar_view)); - - SkBitmap* theme_toolbar = theme_provider->GetBitmapNamed(IDR_THEME_TOOLBAR); - spacer_ = new Spacer(theme_toolbar); - spacer_->SetID(VIEW_ID_SPACER); - AddChildView(spacer_); - InitSystemMenu(); // The ContextMenuController has to be set to a NonClientView but @@ -477,41 +326,16 @@ void BrowserView::Show() { } } -bool BrowserView::IsToolbarVisible() const { - if (is_compact_style()) - return false; - return ::BrowserView::IsToolbarVisible(); -} - -void BrowserView::SetFocusToLocationBar(bool select_all) { - if (is_compact_style()) - ShowCompactLocationBarUnderSelectedTab(select_all); - else - ::BrowserView::SetFocusToLocationBar(select_all); -} - void BrowserView::FocusChromeOSStatus() { SaveFocusedView(); status_area_->SetToolbarFocus(last_focused_view_storage_id(), NULL); } -void BrowserView::ToggleCompactNavigationBar() { - UIStyle new_style = static_cast<UIStyle>((ui_style_ + 1) % 2); - if (new_style != StandardStyle && UseVerticalTabs()) - browser()->ExecuteCommand(IDC_TOGGLE_VERTICAL_TABS); - ui_style_ = new_style; - compact_location_bar_host_->SetEnabled(is_compact_style()); - compact_location_bar_host_->Hide(false); - Layout(); -} - views::LayoutManager* BrowserView::CreateLayoutManager() const { return new BrowserViewLayout(); } void BrowserView::InitTabStrip(TabStripModel* tab_strip_model) { - if (UseVerticalTabs() && is_compact_style()) - ToggleCompactNavigationBar(); ::BrowserView::InitTabStrip(tab_strip_model); UpdateOTRBackground(); } @@ -579,12 +403,6 @@ void BrowserView::OpenButtonOptions(const views::View* button_view) const { } } -bool BrowserView::IsButtonVisible(const views::View* button_view) const { - if (button_view == status_area_->menu_view()) - return !IsToolbarVisible(); - return true; -} - bool BrowserView::IsBrowserMode() const { return true; } @@ -594,16 +412,6 @@ bool BrowserView::IsScreenLockerMode() const { } //////////////////////////////////////////////////////////////////////////////// -// BrowserView public: - -void BrowserView::ShowCompactLocationBarUnderSelectedTab(bool select_all) { - if (!is_compact_style()) - return; - int index = browser()->selected_index(); - compact_location_bar_host_->Update(index, true, select_all); -} - -//////////////////////////////////////////////////////////////////////////////// // BrowserView protected: void BrowserView::GetAccessibleToolbars( diff --git a/chrome/browser/chromeos/frame/browser_view.h b/chrome/browser/chromeos/frame/browser_view.h index 9157607..a338044 100644 --- a/chrome/browser/chromeos/frame/browser_view.h +++ b/chrome/browser/chromeos/frame/browser_view.h @@ -26,10 +26,7 @@ class Profile; namespace chromeos { -class BrowserStatusAreaView; -class CompactLocationBar; -class CompactLocationBarHost; -class CompactNavigationBar; +class StatusAreaView; class StatusAreaButton; // chromeos::BrowserView adds ChromeOS specific controls and menus to a @@ -43,27 +40,13 @@ class BrowserView : public ::BrowserView, public views::ContextMenuController, public StatusAreaHost { public: - // There are three distinct ui styles: - // . Standards uses the same layout as chrome. Within standard the user can - // turn on side tabs. Side tabs are still represented by the constant - // StandardStyle. - // . Compact mode hides the omnibox/toolbar to save the vertical real estate, - // and uses QSB (compact nav bar) to launch/switch url. - enum UIStyle { - StandardStyle = 0, - CompactStyle, - }; - explicit BrowserView(Browser* browser); virtual ~BrowserView(); // BrowserView overrides. virtual void Init(); virtual void Show(); - virtual bool IsToolbarVisible() const; - virtual void SetFocusToLocationBar(bool select_all); virtual void FocusChromeOSStatus(); - virtual void ToggleCompactNavigationBar(); virtual views::LayoutManager* CreateLayoutManager() const; virtual void InitTabStrip(TabStripModel* tab_strip_model); virtual void ChildPreferredSizeChanged(View* child); @@ -81,29 +64,14 @@ class BrowserView : public ::BrowserView, const views::View* button_view) const; virtual void ExecuteBrowserCommand(int id) const; virtual void OpenButtonOptions(const views::View* button_view) const; - virtual bool IsButtonVisible(const views::View* button_view) const; virtual bool IsBrowserMode() const; virtual bool IsScreenLockerMode() const; - // Shows the compact location bar under the selected tab. - void ShowCompactLocationBarUnderSelectedTab(bool select_all); - - // Returns true if the ui style is in Compact mode. - bool is_compact_style() const { - return ui_style_ == CompactStyle; - } - protected: virtual void GetAccessibleToolbars( std::vector<AccessibleToolbarView*>* toolbars); private: - friend class CompactLocationBarHostTest; - - CompactLocationBarHost* compact_location_bar_host() { - return compact_location_bar_host_.get(); - } - void InitSystemMenu(); // Updates the background of the otr icon. The background differs for vertical @@ -111,34 +79,18 @@ class BrowserView : public ::BrowserView, void UpdateOTRBackground(); // Status Area view. - BrowserStatusAreaView* status_area_; + StatusAreaView* status_area_; // System menus. scoped_ptr<menus::SimpleMenuModel> system_menu_contents_; scoped_ptr<views::Menu2> system_menu_menu_; - // CompactNavigationBar view. - CompactNavigationBar* compact_navigation_bar_; - - // The current UI style of the browser. - UIStyle ui_style_; - - // CompactLocationBarHost. - scoped_ptr<CompactLocationBarHost> compact_location_bar_host_; - // A flag to specify if the browser window should be maximized. bool force_maximized_window_; - // A spacer under the tap strip used when the compact navigation bar - // is active. - views::View* spacer_; - // Off the record icon. views::ImageView* otr_avatar_icon_; - // Menu button shown in status area when browser is in compact mode. - StatusAreaButton* menu_view_; - DISALLOW_COPY_AND_ASSIGN(BrowserView); }; diff --git a/chrome/browser/chromeos/frame/normal_browser_frame_view.cc b/chrome/browser/chromeos/frame/normal_browser_frame_view.cc index b25e4ba..84c4614 100644 --- a/chrome/browser/chromeos/frame/normal_browser_frame_view.cc +++ b/chrome/browser/chromeos/frame/normal_browser_frame_view.cc @@ -12,7 +12,6 @@ #include "base/compiler_specific.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_frame.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/tabs/tab_strip.h" diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index 5487c8a..32ad3e4 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -162,7 +162,6 @@ void BackgroundView::InitStatusArea() { DCHECK(status_area_ == NULL); status_area_ = new StatusAreaView(this); status_area_->Init(); - status_area_->Update(); AddChildView(status_area_); } diff --git a/chrome/browser/chromeos/status/browser_status_area_view.cc b/chrome/browser/chromeos/status/browser_status_area_view.cc deleted file mode 100644 index 2e0e867..0000000 --- a/chrome/browser/chromeos/status/browser_status_area_view.cc +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/status/browser_status_area_view.h" - -#include "app/l10n_util.h" -#include "app/menus/simple_menu_model.h" -#include "app/theme_provider.h" -#include "base/string_util.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/app_menu_model.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/browser_window.h" -#include "chrome/browser/browser_theme_provider.h" -#include "chrome/browser/chromeos/frame/browser_view.h" -#include "chrome/browser/chromeos/status/status_area_button.h" -#include "chrome/browser/chromeos/status/status_area_view.h" -#include "chrome/browser/pref_service.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/views/theme_background.h" -#include "chrome/browser/views/toolbar_view.h" -#include "chrome/browser/wrench_menu_model.h" -#include "chrome/common/pref_names.h" -#include "grit/chromium_strings.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "views/controls/menu/menu.h" -#include "views/controls/menu/menu_2.h" -#include "views/window/window.h" - -namespace chromeos { - -class OptionsMenuModel : public menus::SimpleMenuModel, - public menus::SimpleMenuModel::Delegate { - public: - // These extra command IDs must be unique when combined with the options, - // so we just pick up the numbering where that stops. - enum OtherCommands { - CREATE_NEW_WINDOW = StatusAreaView::OPEN_TABS_ON_RIGHT + 1, - }; - - explicit OptionsMenuModel(BrowserView* browser_view) - : SimpleMenuModel(this), - browser_view_(browser_view) { - AddCheckItemWithStringId(IDC_TOGGLE_VERTICAL_TABS, - IDS_TAB_CXMENU_USE_VERTICAL_TABS); - AddSeparator(); - - AddCheckItem(static_cast<int>(StatusAreaView::OPEN_TABS_ON_LEFT), - ASCIIToUTF16("Open tabs on left")); - AddCheckItem(static_cast<int>(StatusAreaView::OPEN_TABS_CLOBBER), - ASCIIToUTF16("Open tabs clobber")); - AddCheckItem(static_cast<int>(StatusAreaView::OPEN_TABS_ON_RIGHT), - ASCIIToUTF16("Open tabs on right")); - } - virtual ~OptionsMenuModel() { - } - - // SimpleMenuModel::Delegate implementation. - virtual bool IsCommandIdChecked(int command_id) const { - if (command_id == IDC_TOGGLE_VERTICAL_TABS) - return browser_view_->UseVerticalTabs(); - return StatusAreaView::GetOpenTabsMode() == command_id; - } - virtual bool IsCommandIdEnabled(int command_id) const { - return true; - } - virtual bool GetAcceleratorForCommandId( - int command_id, - menus::Accelerator* accelerator) { - return false; - } - virtual void ExecuteCommand(int command_id) { - switch (command_id) { - case IDC_TOGGLE_VERTICAL_TABS: - browser_view_->browser()->ExecuteCommand(command_id); - break; - case StatusAreaView::OPEN_TABS_ON_LEFT: - case StatusAreaView::OPEN_TABS_CLOBBER: - case StatusAreaView::OPEN_TABS_ON_RIGHT: - StatusAreaView::SetOpenTabsMode( - static_cast<StatusAreaView::OpenTabsMode>(command_id)); - break; - default: - NOTREACHED(); - } - } - - private: - BrowserView* browser_view_; - - DISALLOW_COPY_AND_ASSIGN(OptionsMenuModel); -}; - -BrowserStatusAreaView::BrowserStatusAreaView(BrowserView* browser_view) - : StatusAreaView(browser_view), - browser_view_(browser_view), - menu_view_(NULL) { -} - -void BrowserStatusAreaView::Init() { - StatusAreaView::Init(); - ThemeProvider* theme = browser_view_->frame()->GetThemeProviderForFrame(); - -// Menu. - menu_view_ = new StatusAreaButton(this); - menu_view_->SetIcon(*theme->GetBitmapNamed(IDR_STATUSBAR_MENU)); - AddChildView(menu_view_); - - set_background(new ThemeBackground(browser_view_)); - - app_menu_contents_.reset(CreateAppMenuModel(this)); - app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); -} - -menus::SimpleMenuModel* BrowserStatusAreaView::CreateAppMenuModel( - menus::SimpleMenuModel::Delegate* delegate) { - Browser* browser = browser_view_->browser(); - menus::SimpleMenuModel* menu_model; - - if (WrenchMenuModel::IsEnabled()) - menu_model = new WrenchMenuModel(delegate, browser); - else - menu_model = new AppMenuModel(delegate, browser); - - // Options menu always uses StatusAreaView as delegate, so - // we can reuse it. - if (!options_menu_contents_.get()) - options_menu_contents_.reset(new OptionsMenuModel(browser_view_)); - - int options_index = menu_model->GetIndexOfCommandId(IDC_OPTIONS); - DCHECK_GE(options_index, 0); - menu_model->InsertSubMenuAt( - options_index + 1, - IDC_EXPERIMENTAL, - ASCIIToUTF16("Experimental"), - options_menu_contents_.get()); - return menu_model; -} - -bool BrowserStatusAreaView::IsCommandIdChecked(int command_id) const { - if (command_id == IDC_SHOW_BOOKMARK_BAR) - return browser_view_->browser()->profile()->GetPrefs()->GetBoolean( - prefs::kShowBookmarkBar); - return false; -} - -bool BrowserStatusAreaView::IsCommandIdEnabled(int command_id) const { - if (command_id == IDC_EXPERIMENTAL) - return true; - Browser* browser = browser_view_->browser(); - return browser->command_updater()->IsCommandEnabled(command_id); -} - -bool BrowserStatusAreaView::GetAcceleratorForCommandId( - int command_id, - menus::Accelerator* accelerator) { - return false; -} - -void BrowserStatusAreaView::ExecuteCommand(int command_id) { - browser_view_->browser()->ExecuteCommand(command_id); -} - -void BrowserStatusAreaView::RunMenu(views::View* source, const gfx::Point& pt) { - app_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/status/browser_status_area_view.h b/chrome/browser/chromeos/status/browser_status_area_view.h deleted file mode 100644 index 5a6b0d3..0000000 --- a/chrome/browser/chromeos/status/browser_status_area_view.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_STATUS_BROWSER_STATUS_AREA_VIEW_H_ -#define CHROME_BROWSER_CHROMEOS_STATUS_BROWSER_STATUS_AREA_VIEW_H_ - -#include "app/menus/simple_menu_model.h" -#include "base/basictypes.h" -#include "chrome/browser/chromeos/status/status_area_view.h" -#include "views/controls/menu/view_menu_delegate.h" -#include "views/controls/menu/menu_2.h" -#include "views/view.h" - -namespace chromeos { - -class BrowserView; -class StatusAreaButton; - -// StatusAreView specialization specific for Chrome browser. -// Adds a menu button visible in compact location bar mode. -class BrowserStatusAreaView : public StatusAreaView, - public menus::SimpleMenuModel::Delegate, - public views::ViewMenuDelegate { - public: - explicit BrowserStatusAreaView(BrowserView* browser_view); - virtual ~BrowserStatusAreaView() {} - - virtual void Init(); - - // Creates the app menu model. - menus::SimpleMenuModel* CreateAppMenuModel( - menus::SimpleMenuModel::Delegate* delegate); - - StatusAreaButton* menu_view() const { return menu_view_; } - - private: - - // menus::SimpleMenuModel::Delegate implementation. - virtual bool IsCommandIdChecked(int command_id) const; - virtual bool IsCommandIdEnabled(int command_id) const; - virtual bool GetAcceleratorForCommandId(int command_id, - menus::Accelerator* accelerator); - virtual void ExecuteCommand(int command_id); - - // views::ViewMenuDelegate implementation. - virtual void RunMenu(views::View* source, const gfx::Point& pt); - - // The browser window that owns us. - BrowserView* browser_view_; - - StatusAreaButton* menu_view_; - - scoped_ptr<menus::SimpleMenuModel> app_menu_contents_; - scoped_ptr<menus::SimpleMenuModel> options_menu_contents_; - scoped_ptr<views::Menu2> app_menu_menu_; - - DISALLOW_COPY_AND_ASSIGN(BrowserStatusAreaView); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_STATUS_BROWSER_STATUS_AREA_VIEW_H_ diff --git a/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc b/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc index 49cfcf3..b0a3106 100644 --- a/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc +++ b/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/system_library.h" #include "chrome/browser/chromeos/frame/browser_view.h" -#include "chrome/browser/chromeos/status/browser_status_area_view.h" +#include "chrome/browser/chromeos/status/status_area_view.h" #include "chrome/browser/chromeos/view_ids.h" #include "chrome/browser/pref_member.h" #include "chrome/browser/profile.h" @@ -27,7 +27,7 @@ class ClockMenuButtonTest : public InProcessBrowserTest { ClockMenuButtonTest() : InProcessBrowserTest() {} ClockMenuButton* GetClockMenuButton() { BrowserView* view = static_cast<BrowserView*>(browser()->window()); - return static_cast<BrowserStatusAreaView*>(view-> + return static_cast<StatusAreaView*>(view-> GetViewByID(VIEW_ID_STATUS_AREA))->clock_view(); } }; diff --git a/chrome/browser/chromeos/status/language_menu_button_browsertest.cc b/chrome/browser/chromeos/status/language_menu_button_browsertest.cc index c2222ce..452e598 100644 --- a/chrome/browser/chromeos/status/language_menu_button_browsertest.cc +++ b/chrome/browser/chromeos/status/language_menu_button_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" #include "chrome/browser/chromeos/cros/mock_input_method_library.h" #include "chrome/browser/chromeos/frame/browser_view.h" -#include "chrome/browser/chromeos/status/browser_status_area_view.h" +#include "chrome/browser/chromeos/status/status_area_view.h" #include "chrome/browser/chromeos/view_ids.h" #include "grit/theme_resources.h" @@ -29,7 +29,7 @@ class LanguageMenuButtonTest : public CrosInProcessBrowserTest { LanguageMenuButton* GetLanguageMenuButton() { BrowserView* view = static_cast<BrowserView*>(browser()->window()); - return static_cast<BrowserStatusAreaView*>(view-> + return static_cast<StatusAreaView*>(view-> GetViewByID(VIEW_ID_STATUS_AREA))->language_view(); } }; diff --git a/chrome/browser/chromeos/status/power_menu_button_browsertest.cc b/chrome/browser/chromeos/status/power_menu_button_browsertest.cc index 38ff8bd..62ffab6 100644 --- a/chrome/browser/chromeos/status/power_menu_button_browsertest.cc +++ b/chrome/browser/chromeos/status/power_menu_button_browsertest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" #include "chrome/browser/chromeos/cros/mock_power_library.h" #include "chrome/browser/chromeos/frame/browser_view.h" -#include "chrome/browser/chromeos/status/browser_status_area_view.h" +#include "chrome/browser/chromeos/status/status_area_view.h" #include "chrome/browser/chromeos/view_ids.h" #include "grit/theme_resources.h" @@ -31,7 +31,7 @@ class PowerMenuButtonTest : public CrosInProcessBrowserTest { PowerMenuButton* GetPowerMenuButton() { BrowserView* view = static_cast<BrowserView*>(browser()->window()); - PowerMenuButton* power = static_cast<BrowserStatusAreaView*>(view-> + PowerMenuButton* power = static_cast<StatusAreaView*>(view-> GetViewByID(VIEW_ID_STATUS_AREA))->power_view(); return power; } diff --git a/chrome/browser/chromeos/status/status_area_host.h b/chrome/browser/chromeos/status/status_area_host.h index d0e4e08..e61cf7c 100644 --- a/chrome/browser/chromeos/status/status_area_host.h +++ b/chrome/browser/chromeos/status/status_area_host.h @@ -37,9 +37,6 @@ class StatusAreaHost { // Executes browser command. virtual void ExecuteBrowserCommand(int id) const = 0; - // Indicates if the button specified should be visible at the moment. - virtual bool IsButtonVisible(const views::View* button_view) const = 0; - // True if status area hosted in browser. Otherwise it's OOBE/login state. virtual bool IsBrowserMode() const = 0; @@ -53,4 +50,3 @@ class StatusAreaHost { } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_HOST_H_ - diff --git a/chrome/browser/chromeos/status/status_area_view.cc b/chrome/browser/chromeos/status/status_area_view.cc index bd4fde8..2e3e88b 100644 --- a/chrome/browser/chromeos/status/status_area_view.cc +++ b/chrome/browser/chromeos/status/status_area_view.cc @@ -57,13 +57,6 @@ void StatusAreaView::Init() { AddChildView(clock_view_); } -void StatusAreaView::Update() { - for (int i = 0; i < GetChildViewCount(); ++i) { - views::View* cur = GetChildViewAt(i); - cur->SetVisible(host_->IsButtonVisible(cur)); - } -} - gfx::Size StatusAreaView::GetPreferredSize() { int result_w = kSeparation; int result_h = 0; diff --git a/chrome/browser/chromeos/status/status_area_view.h b/chrome/browser/chromeos/status/status_area_view.h index 076ed34..6145a36 100644 --- a/chrome/browser/chromeos/status/status_area_view.h +++ b/chrome/browser/chromeos/status/status_area_view.h @@ -33,10 +33,6 @@ class StatusAreaView : public AccessibleToolbarView { virtual void Init(); - // Called when the compact navigation bar mode has changed to - // toggle the app menu visibility. - void Update(); - // views::View* overrides. virtual gfx::Size GetPreferredSize(); virtual void Layout(); diff --git a/chrome/browser/chromeos/view_ids.h b/chrome/browser/chromeos/view_ids.h index 803b8fe..8f0e016 100644 --- a/chrome/browser/chromeos/view_ids.h +++ b/chrome/browser/chromeos/view_ids.h @@ -11,9 +11,7 @@ enum ChromeOSViewIds { // Start with the offset that is big enough to avoid possible // collison. - VIEW_ID_COMPACT_NAV_BAR = VIEW_ID_PREDEFINED_COUNT + 10000, - VIEW_ID_STATUS_AREA, - VIEW_ID_SPACER, + VIEW_ID_STATUS_AREA = VIEW_ID_PREDEFINED_COUNT + 10000, VIEW_ID_OTR_AVATAR, }; diff --git a/chrome/browser/chromeos/wm_overview_controller.cc b/chrome/browser/chromeos/wm_overview_controller.cc index db364be..5e40520 100644 --- a/chrome/browser/chromeos/wm_overview_controller.cc +++ b/chrome/browser/chromeos/wm_overview_controller.cc @@ -20,7 +20,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/tab_contents/thumbnail_generator.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/common/notification_service.h" #include "views/widget/root_view.h" diff --git a/chrome/browser/views/frame/browser_extender.h b/chrome/browser/views/frame/browser_extender.h deleted file mode 100644 index 5d096e4..0000000 --- a/chrome/browser/views/frame/browser_extender.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_EXTENDER_H_ -#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_EXTENDER_H_ - -#include "base/basictypes.h" -#include "gfx/rect.h" - -class BrowserView; - -// Note: This class is deprecated (but still in use) -// and will be removed in the near future. -// -// BrowserExtender adds chromeos specific features to BrowserView. -// The factory method |Create(BrowserView*)| creates different types -// of extender depending on the type of BrowserView and target platform. -// Please see browser/chromeos/browser_extenders.cc for ChromeOS extenders, and -// standard_extender.cc for Chrome browser. -class BrowserExtender { - public: - BrowserExtender() - : can_close_(true) { - } - - virtual ~BrowserExtender() {} - - // Tells if the browser can be closed. - bool can_close() const { - return can_close_; - } - - // Specifies if the browser can be closed or not. This typically set - // to false when the browser is being dragged. - void set_can_close(bool b) { - can_close_ = b; - } - - private: - // True if the browser can be closed. See set_can_close method for setails. - bool can_close_; - - DISALLOW_COPY_AND_ASSIGN(BrowserExtender); -}; - -#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_EXTENDER_H_ diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc index 74a6cf9..a1302ee 100644 --- a/chrome/browser/views/frame/browser_frame_gtk.cc +++ b/chrome/browser/views/frame/browser_frame_gtk.cc @@ -9,7 +9,6 @@ #include "chrome/browser/profile.h" #include "chrome/browser/status_bubble.h" #include "chrome/browser/views/frame/app_panel_browser_frame_view.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_root_view.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/frame/opaque_browser_frame_view.h" diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 304f6fc..a34ab3a 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -33,7 +33,6 @@ #include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/download_shelf_view.h" #include "chrome/browser/views/extensions/extension_shelf.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_view_layout.h" #include "chrome/browser/views/fullscreen_exit_bubble.h" #include "chrome/browser/views/status_bubble_views.h" @@ -449,9 +448,6 @@ BrowserView::~BrowserView() { // notifications will call back into deleted objects). download_shelf_.reset(); - // Destory extender before destroying browser. - browser_extender_.reset(); - // The TabStrip attaches a listener to the model. Make sure we shut down the // TabStrip first so that it can cleanly remove the listener. tabstrip_->GetParent()->RemoveChildView(tabstrip_); @@ -1256,11 +1252,6 @@ void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { GetFocusManager()); } -#if defined(OS_CHROMEOS) -void BrowserView::ToggleCompactNavigationBar() { -} -#endif - // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always // enabled in the page menu regardless of whether the command will do // anything. When someone selects the menu item, we just act as if they hit @@ -1591,9 +1582,6 @@ views::ClientView* BrowserView::CreateClientView(views::Window* window) { // BrowserView, views::ClientView overrides: bool BrowserView::CanClose() const { - if (!browser_extender_->can_close()) - return false; - // You cannot close a frame for which there is an active originating drag // session. if (tabstrip_->IsDragSessionActive()) @@ -1862,8 +1850,6 @@ void BrowserView::Init() { } #endif - browser_extender_.reset(new BrowserExtender()); - // We're now initialized and ready to process Layout requests. ignore_layout_ = false; } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 1300bc4..52794ab 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -44,7 +44,6 @@ class AccessibleViewHelper; class BookmarkBarView; class Browser; class BrowserBubble; -class BrowserExtender; class BrowserViewLayout; class DownloadShelfView; class EncodingMenuModel; @@ -250,8 +249,6 @@ class BrowserView : public BrowserBubbleHost, // Called when the activation of the frame changes. virtual void ActivationChanged(bool activated); - BrowserExtender* browser_extender() const { return browser_extender_.get(); } - // Overriden from ImageLoadingTracker::Observer. virtual void OnImageLoaded(SkBitmap* image, ExtensionResource resource, int index); @@ -331,9 +328,6 @@ class BrowserView : public BrowserBubbleHost, bool* is_keyboard_shortcut); virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); virtual void ShowCreateShortcutsDialog(TabContents* tab_contents); -#if defined(OS_CHROMEOS) - virtual void ToggleCompactNavigationBar(); -#endif // defined(OS_CHROMEOS) virtual void Cut(); virtual void Copy(); virtual void Paste(); @@ -603,8 +597,6 @@ class BrowserView : public BrowserBubbleHost, // A bottom bar for showing extensions. ExtensionShelf* extension_shelf_; - scoped_ptr<BrowserExtender> browser_extender_; - UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; scoped_ptr<AccessibleViewHelper> accessible_view_helper_; diff --git a/chrome/browser/views/frame/browser_view_layout.cc b/chrome/browser/views/frame/browser_view_layout.cc index e26b669c..a332beb 100644 --- a/chrome/browser/views/frame/browser_view_layout.cc +++ b/chrome/browser/views/frame/browser_view_layout.cc @@ -10,7 +10,6 @@ #include "chrome/browser/views/bookmark_bar_view.h" #include "chrome/browser/views/download_shelf_view.h" #include "chrome/browser/views/extensions/extension_shelf.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_frame.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/tabs/side_tab_strip.h" diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc index d60eafa..fc6f4de 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -10,7 +10,6 @@ #include "base/compiler_specific.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/views/frame/browser_extender.h" #include "chrome/browser/views/frame/browser_frame.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/tabs/tab_strip.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index cf77bce..7da139b 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -357,12 +357,6 @@ 'browser/chromeos/boot_times_loader.cc', 'browser/chromeos/boot_times_loader.h', 'browser/chromeos/browser_notification_observers.cc', - 'browser/chromeos/compact_location_bar_host.cc', - 'browser/chromeos/compact_location_bar_host.h', - 'browser/chromeos/compact_location_bar_view.cc', - 'browser/chromeos/compact_location_bar_view.h', - 'browser/chromeos/compact_navigation_bar.cc', - 'browser/chromeos/compact_navigation_bar.h', 'browser/chromeos/cros_settings.cc', 'browser/chromeos/cros_settings.h', 'browser/chromeos/cros_settings_names.cc', @@ -578,8 +572,6 @@ 'browser/chromeos/preferences.h', 'browser/chromeos/pulse_audio_mixer.cc', 'browser/chromeos/pulse_audio_mixer.h', - 'browser/chromeos/status/browser_status_area_view.cc', - 'browser/chromeos/status/browser_status_area_view.h', 'browser/chromeos/status/clock_menu_button.cc', 'browser/chromeos/status/clock_menu_button.h', 'browser/chromeos/status/feedback_menu_button.cc', @@ -2570,7 +2562,6 @@ 'browser/views/frame/app_panel_browser_frame_view.h', 'browser/views/frame/browser_bubble_host.cc', 'browser/views/frame/browser_bubble_host.h', - 'browser/views/frame/browser_extender.h', 'browser/views/frame/browser_frame.h', 'browser/views/frame/browser_frame_gtk.cc', 'browser/views/frame/browser_frame_gtk.h', @@ -3260,7 +3251,6 @@ ['include', '^browser/views/frame/browser_bubble_host.h'], ['include', '^browser/views/frame/browser_view_layout.cc'], ['include', '^browser/views/frame/browser_view_layout.h'], - ['include', '^browser/views/frame/browser_extender.h'], ['include', '^browser/views/frame/browser_view.cc'], ['include', '^browser/views/frame/browser_view.h'], ['include', '^browser/views/frame/browser_frame_gtk.cc'], |