diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 16:20:34 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 16:20:34 +0000 |
commit | c2ed64c1ab691d0fb25bace59950a9055c166a14 (patch) | |
tree | 37b91cf6714443d77c7c35149572d6f712bdf388 | |
parent | fb2ab08257345bff2d48e74f1d5e96faf2f8b493 (diff) | |
download | chromium_src-c2ed64c1ab691d0fb25bace59950a9055c166a14.zip chromium_src-c2ed64c1ab691d0fb25bace59950a9055c166a14.tar.gz chromium_src-c2ed64c1ab691d0fb25bace59950a9055c166a14.tar.bz2 |
A patch to fix a couple of issues in interactive_ui_tests on ChromeOS
* Removed two static SkBitmap objects.
- default_favicion does not seem to be in use. Removed along with InitClass.
- Moved to local static and moved to heap. SkBitmap destructor was failing on
exit (in pthread_mutex_lock)
* Set VIEW_ID_TAB_CONTAINER_FOCUS_VIEW to the tab container (this ID is required in the test)
* Use FocusManager and call TabContentsDelegate::TakeFocus
in TabContentsViewGtk::TakeFocus.
BUG=39736
TEST=none (interactive_ui_tests needs more patch to run)
Review URL: http://codereview.chromium.org/1594003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43617 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 17 insertions, 27 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index f8e5b9c..3ab122d 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -73,9 +73,6 @@ using base::TimeDelta; using views::ColumnSet; using views::GridLayout; -// static -SkBitmap BrowserView::default_favicon_; -SkBitmap BrowserView::otr_avatar_; // The height of the status bubble. static const int kStatusBubbleHeight = 20; // The name of a key to store on the window handle so that other code can @@ -400,7 +397,6 @@ BrowserView::BrowserView(Browser* browser) extension_shelf_(NULL), last_focused_view_storage_id_( views::ViewStorage::GetSharedInstance()->CreateStorageID()) { - InitClass(); browser_->tabstrip_model()->AddObserver(this); } @@ -601,11 +597,13 @@ TabContents* BrowserView::GetSelectedTabContents() const { } SkBitmap BrowserView::GetOTRAvatarIcon() { - if (otr_avatar_.isNull()) { + static SkBitmap* otr_avatar_ = new SkBitmap(); + + if (otr_avatar_->isNull()) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); + *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); } - return otr_avatar_; + return *otr_avatar_; } #if defined(OS_WIN) @@ -2114,16 +2112,6 @@ void BrowserView::InitHangMonitor() { #endif } -// static -void BrowserView::InitClass() { - static bool initialized = false; - if (!initialized) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); - initialized = true; - } -} - #if !defined(OS_CHROMEOS) // static BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 1e01f28..2926b97 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -526,12 +526,6 @@ class BrowserView : public BrowserBubbleHost, scoped_ptr<FullscreenExitBubble> fullscreen_bubble_; - // The default favicon image. - static SkBitmap default_favicon_; - - // The OTR avatar image. - static SkBitmap otr_avatar_; - #if defined(OS_WIN) // The additional items we insert into the system menu. scoped_ptr<views::SystemMenuModel> system_menu_contents_; diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc index 9e09839..241ca35 100644 --- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc +++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc @@ -7,6 +7,7 @@ #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/tab_contents/interstitial_page.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/view_ids.h" #include "chrome/browser/views/tab_contents/tab_contents_container.h" #include "views/focus/focus_manager.h" #include "views/widget/root_view.h" @@ -19,6 +20,7 @@ NativeTabContentsContainerGtk::NativeTabContentsContainerGtk( TabContentsContainer* container) : container_(container), focus_callback_id_(0) { + SetID(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); } NativeTabContentsContainerGtk::~NativeTabContentsContainerGtk() { diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc index e302838..b8d2907 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc @@ -326,10 +326,16 @@ void TabContentsViewGtk::GotFocus() { } void TabContentsViewGtk::TakeFocus(bool reverse) { - // This is called when we the renderer asks us to take focus back (i.e., it - // has iterated past the last focusable element on the page). - gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()), - reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD); + if (!tab_contents()->delegate()->TakeFocus(reverse)) { + + views::FocusManager* focus_manager = + views::FocusManager::GetFocusManagerForNativeView(GetNativeView()); + + // We may not have a focus manager if the tab has been switched before this + // message arrived. + if (focus_manager) + focus_manager->AdvanceFocus(reverse); + } } void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { |