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

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: 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
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 ee59f1810df80d6c187de363f216dcd40eb08c02..03e58256af2d44adcca440abf57f40b745bf9617 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"
@@ -27,6 +28,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"
@@ -1406,6 +1408,20 @@ int LocationBarView::GetDragOperationsForView(views::View* sender,
ui::DragDropTypes::DRAG_NONE;
}
+void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
sky 2012/12/12 03:46:55 Make position match that of header.
melevin 2012/12/12 19:32:43 Done.
+ if (browser_ && browser_->instant_controller()) {
sky 2012/12/12 03:46:55 Add a check for parent() here too.
melevin 2012/12/12 19:32:43 Done.
+ // 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();
+ int end =
+ parent_bounds.x() + parent_bounds.width() - bounds.width() - start;
+ if (base::i18n::IsRTL())
+ std::swap(start, end);
+ browser_->instant_controller()->SetMarginSize(start, end);
+ }
+}
+
bool LocationBarView::CanStartDragForView(View* sender,
const gfx::Point& press_pt,
const gfx::Point& p) {

Powered by Google App Engine
This is Rietveld 408576698