Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 10832216: Clicks broken in NTP section of Search overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 AddChildView(infobar_container_); 1927 AddChildView(infobar_container_);
1928 1928
1929 contents_container_ = new views::WebView(browser_->profile()); 1929 contents_container_ = new views::WebView(browser_->profile());
1930 contents_container_->set_id(VIEW_ID_TAB_CONTAINER); 1930 contents_container_->set_id(VIEW_ID_TAB_CONTAINER);
1931 contents_ = new ContentsContainer(contents_container_); 1931 contents_ = new ContentsContainer(contents_container_);
1932 1932
1933 views::View* omnibox_popup_view_parent = NULL; 1933 views::View* omnibox_popup_view_parent = NULL;
1934 // SearchViewController doesn't work on windows yet. 1934 // SearchViewController doesn't work on windows yet.
1935 #if defined(USE_AURA) 1935 #if defined(USE_AURA)
1936 if (chrome::search::IsInstantExtendedAPIEnabled(browser_->profile())) { 1936 if (chrome::search::IsInstantExtendedAPIEnabled(browser_->profile())) {
1937 search_view_controller_.reset( 1937 search_view_controller_.reset(new SearchViewController(contents_));
1938 new SearchViewController(browser_->profile(), contents_));
1939 omnibox_popup_view_parent = 1938 omnibox_popup_view_parent =
1940 search_view_controller_->omnibox_popup_view_parent(); 1939 search_view_controller_->omnibox_popup_view_parent();
1941 } 1940 }
1942 #endif 1941 #endif
1943 1942
1944 toolbar_ = new ToolbarView(browser_.get()); 1943 toolbar_ = new ToolbarView(browser_.get());
1945 AddChildView(toolbar_); 1944 AddChildView(toolbar_);
1946 toolbar_->Init(this, omnibox_popup_view_parent); 1945 toolbar_->Init(this, omnibox_popup_view_parent);
1947 1946
1948 #if defined(USE_AURA) 1947 #if defined(USE_AURA)
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 DCHECK(new_contents); 2451 DCHECK(new_contents);
2453 bool change_tab_contents = 2452 bool change_tab_contents =
2454 contents_container_->web_contents() != new_contents->web_contents(); 2453 contents_container_->web_contents() != new_contents->web_contents();
2455 2454
2456 // Update various elements that are interested in knowing the current 2455 // Update various elements that are interested in knowing the current
2457 // WebContents. 2456 // WebContents.
2458 2457
2459 // When we toggle the NTP floating bookmarks bar and/or the info bar, 2458 // When we toggle the NTP floating bookmarks bar and/or the info bar,
2460 // we don't want any WebContents to be attached, so that we 2459 // we don't want any WebContents to be attached, so that we
2461 // avoid an unnecessary resize and re-layout of a WebContents. 2460 // avoid an unnecessary resize and re-layout of a WebContents.
2461 // This also applies to the |search_view_controller_| logic, as it can
2462 // reparent the |contents_container_|.
2462 if (change_tab_contents) 2463 if (change_tab_contents)
2463 contents_container_->SetWebContents(NULL); 2464 contents_container_->SetWebContents(NULL);
2464 infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); 2465 infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper());
2465 if (bookmark_bar_view_.get()) { 2466 if (bookmark_bar_view_.get()) {
2466 bookmark_bar_view_->SetBookmarkBarState( 2467 bookmark_bar_view_->SetBookmarkBarState(
2467 browser_->bookmark_bar_state(), 2468 browser_->bookmark_bar_state(),
2468 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 2469 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
2469 } 2470 }
2470 UpdateUIForContents(new_contents); 2471 UpdateUIForContents(new_contents);
2471 if (change_tab_contents)
2472 contents_container_->SetWebContents(new_contents->web_contents());
2473 2472
2474 #if defined(USE_AURA) 2473 #if defined(USE_AURA)
2475 // |change_tab_contents| can mean same WebContents but different TabContents, 2474 // |change_tab_contents| can mean same WebContents but different TabContents,
2476 // so let SearchViewController decide how it would handle |new_contents|. 2475 // so let SearchViewController decide how it would handle |new_contents|.
2477 if (search_view_controller_.get()) 2476 if (search_view_controller_.get())
2478 search_view_controller_->SetTabContents(new_contents); 2477 search_view_controller_->SetTabContents(new_contents);
2479 #endif 2478 #endif
2480 2479
2480 if (change_tab_contents)
2481 contents_container_->SetWebContents(new_contents->web_contents());
2482
2481 UpdateDevToolsForContents(new_contents); 2483 UpdateDevToolsForContents(new_contents);
2482 if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() && 2484 if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() &&
2483 GetWidget()->IsVisible()) { 2485 GetWidget()->IsVisible()) {
2484 // We only restore focus if our window is visible, to avoid invoking blur 2486 // We only restore focus if our window is visible, to avoid invoking blur
2485 // handlers when we are eventually shown. 2487 // handlers when we are eventually shown.
2486 new_contents->web_contents()->GetView()->RestoreFocus(); 2488 new_contents->web_contents()->GetView()->RestoreFocus();
2487 } 2489 }
2488 2490
2489 // Update all the UI bits. 2491 // Update all the UI bits.
2490 UpdateTitleBar(); 2492 UpdateTitleBar();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 if (contents && contents->GetContentNativeView() && 2587 if (contents && contents->GetContentNativeView() &&
2586 contents->GetContentNativeView()->HasFocus()) { 2588 contents->GetContentNativeView()->HasFocus()) {
2587 (contents->GetRenderViewHost()->*method)(); 2589 (contents->GetRenderViewHost()->*method)();
2588 return true; 2590 return true;
2589 } 2591 }
2590 #elif defined(OS_WIN) 2592 #elif defined(OS_WIN)
2591 // TODO(yusukes): Support non-Aura Windows. 2593 // TODO(yusukes): Support non-Aura Windows.
2592 #endif 2594 #endif
2593 return false; 2595 return false;
2594 } 2596 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698