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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 11359198: Implement the Instant extended API startMargin, endMargin, and rtl properties and the onmarginchang… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build error (PopupChangedBoundsTo -> OnPopupChangedBounds) Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 860c75b034750daa00f8d385bd113ed97905f513..9714e3c17e304bd4319f045a765b344e1fc84bdb 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -8,6 +8,7 @@
#include <map>
#include "base/command_line.h"
+#include "base/i18n/rtl.h"
#include "base/stl_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -26,6 +27,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_instant_controller.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/omnibox/location_bar_util.h"
#include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
@@ -1368,6 +1370,19 @@ bool LocationBarView::HasFocus() const {
return location_entry_->model()->has_focus();
}
+void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
+ if (browser_ && browser_->instant_controller() && parent()) {
+ // Pass the side margins of the location bar to the Instant Controller.
+ const gfx::Rect bounds = GetBoundsInScreen();
+ const gfx::Rect parent_bounds = parent()->GetBoundsInScreen();
+ int start = bounds.x() - parent_bounds.x();
+ int end = parent_bounds.right() - bounds.right();
+ if (base::i18n::IsRTL())
+ std::swap(start, end);
+ browser_->instant_controller()->SetMarginSize(start, end);
+ }
+}
+
void LocationBarView::WriteDragDataForView(views::View* sender,
const gfx::Point& press_pt,
OSExchangeData* data) {
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698