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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 17431003: Dragging panels near screen edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dragging panels near screen edge (comments) Created 7 years, 6 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
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/extensions/api/tabs/tabs_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 break; 745 break;
746 default: 746 default:
747 break; 747 break;
748 } 748 }
749 749
750 gfx::Rect bounds; 750 gfx::Rect bounds;
751 if (controller->window()->IsMinimized()) 751 if (controller->window()->IsMinimized())
752 bounds = controller->window()->GetRestoredBounds(); 752 bounds = controller->window()->GetRestoredBounds();
753 else 753 else
754 bounds = controller->window()->GetBounds(); 754 bounds = controller->window()->GetBounds();
755 // TODO: Updating bounds during a drag can cause problems and a more general
756 // solution is needed. See http://crbug.com/251813 .
755 bool set_bounds = false; 757 bool set_bounds = false;
756 758
757 // Any part of the bounds can optionally be set by the caller. 759 // Any part of the bounds can optionally be set by the caller.
758 int bounds_val; 760 int bounds_val;
759 if (update_props->HasKey(keys::kLeftKey)) { 761 if (update_props->HasKey(keys::kLeftKey)) {
760 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 762 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
761 keys::kLeftKey, 763 keys::kLeftKey,
762 &bounds_val)); 764 &bounds_val));
763 bounds.set_x(bounds_val); 765 if (bounds.x() != bounds_val) {
764 set_bounds = true; 766 bounds.set_x(bounds_val);
767 set_bounds = true;
768 }
765 } 769 }
766 770
767 if (update_props->HasKey(keys::kTopKey)) { 771 if (update_props->HasKey(keys::kTopKey)) {
768 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 772 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
769 keys::kTopKey, 773 keys::kTopKey,
770 &bounds_val)); 774 &bounds_val));
771 bounds.set_y(bounds_val); 775 if (bounds.y() != bounds_val) {
772 set_bounds = true; 776 bounds.set_y(bounds_val);
777 set_bounds = true;
778 }
773 } 779 }
774 780
775 if (update_props->HasKey(keys::kWidthKey)) { 781 if (update_props->HasKey(keys::kWidthKey)) {
776 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 782 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
777 keys::kWidthKey, 783 keys::kWidthKey,
778 &bounds_val)); 784 &bounds_val));
779 bounds.set_width(bounds_val); 785 if (bounds.width() != bounds_val) {
780 set_bounds = true; 786 bounds.set_width(bounds_val);
787 set_bounds = true;
788 }
781 } 789 }
782 790
783 if (update_props->HasKey(keys::kHeightKey)) { 791 if (update_props->HasKey(keys::kHeightKey)) {
784 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 792 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
785 keys::kHeightKey, 793 keys::kHeightKey,
786 &bounds_val)); 794 &bounds_val));
787 bounds.set_height(bounds_val); 795 if (bounds.height() != bounds_val) {
788 set_bounds = true; 796 bounds.set_height(bounds_val);
797 set_bounds = true;
798 }
789 } 799 }
790 800
791 if (set_bounds) { 801 if (set_bounds) {
flackr 2013/06/20 19:47:46 FYI, this comment may be relevant as well: https:/
792 if (show_state == ui::SHOW_STATE_MINIMIZED || 802 if (show_state == ui::SHOW_STATE_MINIMIZED ||
793 show_state == ui::SHOW_STATE_MAXIMIZED || 803 show_state == ui::SHOW_STATE_MAXIMIZED ||
794 show_state == ui::SHOW_STATE_FULLSCREEN) { 804 show_state == ui::SHOW_STATE_FULLSCREEN) {
795 error_ = keys::kInvalidWindowStateError; 805 error_ = keys::kInvalidWindowStateError;
796 return false; 806 return false;
797 } 807 }
798 controller->window()->SetBounds(bounds); 808 controller->window()->SetBounds(bounds);
799 } 809 }
800 810
801 bool active_val = false; 811 bool active_val = false;
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 execute_tab_id_ = tab_id; 2077 execute_tab_id_ = tab_id;
2068 details_ = details.Pass(); 2078 details_ = details.Pass();
2069 return true; 2079 return true;
2070 } 2080 }
2071 2081
2072 bool TabsInsertCSSFunction::ShouldInsertCSS() const { 2082 bool TabsInsertCSSFunction::ShouldInsertCSS() const {
2073 return true; 2083 return true;
2074 } 2084 }
2075 2085
2076 } // namespace extensions 2086 } // namespace extensions
OLDNEW
« ash/wm/toplevel_window_event_handler.cc ('K') | « ash/wm/toplevel_window_event_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698