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

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

Issue 545044: Add the ability to focus a window to chrome.window.update(). (Closed)
Patch Set: tabs Created 10 years, 11 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/chrome_tests.gypi » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/gfx/codec/jpeg_codec.h" 7 #include "app/gfx/codec/jpeg_codec.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 381
382 if (update_props->HasKey(keys::kHeightKey)) { 382 if (update_props->HasKey(keys::kHeightKey)) {
383 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 383 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
384 keys::kHeightKey, 384 keys::kHeightKey,
385 &bounds_val)); 385 &bounds_val));
386 bounds.set_height(bounds_val); 386 bounds.set_height(bounds_val);
387 } 387 }
388 388
389 browser->window()->SetBounds(bounds); 389 browser->window()->SetBounds(bounds);
390 // TODO(rafaelw): Support |focused|. 390
391 if (update_props->HasKey(keys::kFocusedKey)) {
392 bool focused = false;
393 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean(keys::kFocusedKey,
394 &focused));
395 if (focused)
396 browser->window()->Activate();
397 }
398
391 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); 399 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false));
392 400
393 return true; 401 return true;
394 } 402 }
395 403
396 bool RemoveWindowFunction::RunImpl() { 404 bool RemoveWindowFunction::RunImpl() {
397 int window_id; 405 int window_id;
398 EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&window_id)); 406 EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&window_id));
399 407
400 Browser* browser = GetBrowserInProfileWithId(profile(), window_id, &error_); 408 Browser* browser = GetBrowserInProfileWithId(profile(), window_id, &error_);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, 918 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip,
911 contents, tab_index)) 919 contents, tab_index))
912 return true; 920 return true;
913 921
914 if (error_message) 922 if (error_message)
915 *error_message = ExtensionErrorUtils::FormatErrorMessage( 923 *error_message = ExtensionErrorUtils::FormatErrorMessage(
916 keys::kTabNotFoundError, IntToString(tab_id)); 924 keys::kTabNotFoundError, IntToString(tab_id));
917 925
918 return false; 926 return false;
919 } 927 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698