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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 3584010: Add chrome.windows.update({focused:true}); (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 2 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
« no previous file with comments | « no previous file | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 &bounds_val)); 442 &bounds_val));
443 bounds.set_width(bounds_val); 443 bounds.set_width(bounds_val);
444 } 444 }
445 445
446 if (update_props->HasKey(keys::kHeightKey)) { 446 if (update_props->HasKey(keys::kHeightKey)) {
447 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 447 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
448 keys::kHeightKey, 448 keys::kHeightKey,
449 &bounds_val)); 449 &bounds_val));
450 bounds.set_height(bounds_val); 450 bounds.set_height(bounds_val);
451 } 451 }
452 browser->window()->SetBounds(bounds);
452 453
453 browser->window()->SetBounds(bounds); 454 bool selected_val = false;
455 if (update_props->HasKey(keys::kFocusedKey)) {
456 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean(
457 keys::kFocusedKey, &selected_val));
458 if (selected_val)
459 browser->window()->Activate();
460 else
461 browser->window()->Deactivate();
462 }
463
454 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); 464 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false));
455 465
456 return true; 466 return true;
457 } 467 }
458 468
459 bool RemoveWindowFunction::RunImpl() { 469 bool RemoveWindowFunction::RunImpl() {
460 int window_id; 470 int window_id;
461 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); 471 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id));
462 472
463 Browser* browser = GetBrowserInProfileWithId(profile(), window_id, 473 Browser* browser = GetBrowserInProfileWithId(profile(), window_id,
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 } 1128 }
1119 1129
1120 static GURL ResolvePossiblyRelativeURL(std::string url_string, 1130 static GURL ResolvePossiblyRelativeURL(std::string url_string,
1121 Extension* extension) { 1131 Extension* extension) {
1122 GURL url = GURL(url_string); 1132 GURL url = GURL(url_string);
1123 if (!url.is_valid()) 1133 if (!url.is_valid())
1124 url = extension->GetResourceURL(url_string); 1134 url = extension->GetResourceURL(url_string);
1125 1135
1126 return url; 1136 return url;
1127 } 1137 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698