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

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

Issue 9428018: Create BaseWindow and ExtensionWindowWrapper for extension API access to Panels (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 10 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/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/string16.h" 16 #include "base/string16.h"
17 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/stringprintf.h" 19 #include "base/stringprintf.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "chrome/browser/extensions/extension_function_dispatcher.h" 21 #include "chrome/browser/extensions/extension_function_dispatcher.h"
22 #include "chrome/browser/extensions/extension_host.h" 22 #include "chrome/browser/extensions/extension_host.h"
23 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/extensions/extension_tab_util.h" 24 #include "chrome/browser/extensions/extension_tab_util.h"
25 #include "chrome/browser/extensions/extension_tabs_module_constants.h" 25 #include "chrome/browser/extensions/extension_tabs_module_constants.h"
26 #include "chrome/browser/extensions/extension_window_wrapper.h"
26 #include "chrome/browser/net/url_fixer_upper.h" 27 #include "chrome/browser/net/url_fixer_upper.h"
27 #include "chrome/browser/prefs/incognito_mode_prefs.h" 28 #include "chrome/browser/prefs/incognito_mode_prefs.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/sessions/restore_tab_helper.h" 30 #include "chrome/browser/sessions/restore_tab_helper.h"
30 #include "chrome/browser/tabs/tab_strip_model.h" 31 #include "chrome/browser/tabs/tab_strip_model.h"
31 #include "chrome/browser/translate/translate_tab_helper.h" 32 #include "chrome/browser/translate/translate_tab_helper.h"
32 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
33 #include "chrome/browser/ui/browser_list.h" 34 #include "chrome/browser/ui/browser_list.h"
34 #include "chrome/browser/ui/browser_navigator.h" 35 #include "chrome/browser/ui/browser_navigator.h"
35 #include "chrome/browser/ui/browser_window.h" 36 #include "chrome/browser/ui/browser_window.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Windows --------------------------------------------------------------------- 225 // Windows ---------------------------------------------------------------------
225 226
226 bool GetWindowFunction::RunImpl() { 227 bool GetWindowFunction::RunImpl() {
227 scoped_ptr<Get::Params> params(Get::Params::Create(*args_)); 228 scoped_ptr<Get::Params> params(Get::Params::Create(*args_));
228 EXTENSION_FUNCTION_VALIDATE(params.get()); 229 EXTENSION_FUNCTION_VALIDATE(params.get());
229 230
230 bool populate_tabs = false; 231 bool populate_tabs = false;
231 if (params->get_info.get() && params->get_info->populate.get()) 232 if (params->get_info.get() && params->get_info->populate.get())
232 populate_tabs = *params->get_info->populate; 233 populate_tabs = *params->get_info->populate;
233 234
234 Browser* browser = NULL; 235 ExtensionWindowWrapper* wrapper =
235 if (!GetBrowserFromWindowID(this, params->window_id, &browser)) 236 ExtensionWindowWrapperList::GetInstance()->FindWindowById(
237 profile(), include_incognito(), params->window_id);
238 if (!wrapper)
236 return false; 239 return false;
237 240
238 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, populate_tabs)); 241 result_.reset(wrapper->CreateWindowValue(populate_tabs));
239 return true; 242 return true;
240 } 243 }
241 244
242 bool GetCurrentWindowFunction::RunImpl() { 245 bool GetCurrentWindowFunction::RunImpl() {
243 scoped_ptr<GetCurrent::Params> params(GetCurrent::Params::Create(*args_)); 246 scoped_ptr<GetCurrent::Params> params(GetCurrent::Params::Create(*args_));
244 EXTENSION_FUNCTION_VALIDATE(params.get()); 247 EXTENSION_FUNCTION_VALIDATE(params.get());
245 248
246 bool populate_tabs = false; 249 bool populate_tabs = false;
247 if (params->get_info.get() && params->get_info->populate.get()) 250 if (params->get_info.get() && params->get_info->populate.get())
248 populate_tabs = *params->get_info->populate; 251 populate_tabs = *params->get_info->populate;
249 252
250 Browser* browser = GetCurrentBrowser(); 253 // If there is a Browser associated with this extension, use that.
251 if (!browser || !browser->window()) { 254 ExtensionWindowWrapper* wrapper =
252 error_ = keys::kNoCurrentWindowError; 255 dispatcher()->delegate()->GetBrowser()->extension_window_wrapper();
256 if (!wrapper) {
257 // Otherwise get the focused or most recently added window.
258 wrapper = ExtensionWindowWrapperList::GetInstance()->CurrentWindow(
259 profile(), include_incognito());
260 }
261 if (!wrapper)
253 return false; 262 return false;
254 } 263 result_.reset(wrapper->CreateWindowValue(populate_tabs));
255 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, populate_tabs));
256 return true; 264 return true;
257 } 265 }
258 266
259 bool GetLastFocusedWindowFunction::RunImpl() { 267 bool GetLastFocusedWindowFunction::RunImpl() {
260 scoped_ptr<GetLastFocused::Params> params( 268 scoped_ptr<GetLastFocused::Params> params(
261 GetLastFocused::Params::Create(*args_)); 269 GetLastFocused::Params::Create(*args_));
262 EXTENSION_FUNCTION_VALIDATE(params.get()); 270 EXTENSION_FUNCTION_VALIDATE(params.get());
263 271
264 bool populate_tabs = false; 272 bool populate_tabs = false;
265 if (params->get_info.get() && params->get_info->populate.get()) 273 if (params->get_info.get() && params->get_info->populate.get())
266 populate_tabs = *params->get_info->populate; 274 populate_tabs = *params->get_info->populate;
267 275
268 Browser* browser = BrowserList::FindAnyBrowser( 276 ExtensionWindowWrapper* wrapper =
269 profile(), include_incognito()); 277 ExtensionWindowWrapperList::GetInstance()->FocusedWindow(
270 if (!browser || !browser->window()) { 278 profile(), include_incognito());
279 if (!wrapper) {
271 error_ = keys::kNoLastFocusedWindowError; 280 error_ = keys::kNoLastFocusedWindowError;
272 return false; 281 return false;
273 } 282 }
274 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, populate_tabs)); 283 result_.reset(wrapper->CreateWindowValue(populate_tabs));
275 return true; 284 return true;
276 } 285 }
277 286
278 bool GetAllWindowsFunction::RunImpl() { 287 bool GetAllWindowsFunction::RunImpl() {
279 scoped_ptr<GetAll::Params> params(GetAll::Params::Create(*args_)); 288 scoped_ptr<GetAll::Params> params(GetAll::Params::Create(*args_));
280 EXTENSION_FUNCTION_VALIDATE(params.get()); 289 EXTENSION_FUNCTION_VALIDATE(params.get());
281 290
282 bool populate_tabs = false; 291 bool populate_tabs = false;
283 if (params->get_info.get() && params->get_info->populate.get()) 292 if (params->get_info.get() && params->get_info->populate.get())
284 populate_tabs = *params->get_info->populate; 293 populate_tabs = *params->get_info->populate;
285 294
286 result_.reset(new ListValue()); 295 ListValue* window_list = new ListValue();
287 Profile* incognito_profile = 296 const ExtensionWindowWrapperList::WindowList& windows =
288 include_incognito() && profile()->HasOffTheRecordProfile() ? 297 ExtensionWindowWrapperList::GetInstance()->windows();
289 profile()->GetOffTheRecordProfile() : NULL; 298 for (ExtensionWindowWrapperList::WindowList::const_iterator iter =
290 for (BrowserList::const_iterator browser = BrowserList::begin(); 299 windows.begin();
291 browser != BrowserList::end(); ++browser) { 300 iter != windows.end(); ++iter) {
292 // Only examine browsers in the current profile that have windows. 301 if ((*iter)->MatchesProfile(profile(), include_incognito()))
293 if (((*browser)->profile() == profile() || 302 window_list->Append((*iter)->CreateWindowValue(populate_tabs));
294 (*browser)->profile() == incognito_profile) &&
295 (*browser)->window()) {
296 static_cast<ListValue*>(result_.get())->
297 Append(ExtensionTabUtil::CreateWindowValue(*browser, populate_tabs));
298 }
299 } 303 }
300 304 result_.reset(window_list);
301 return true; 305 return true;
302 } 306 }
303 307
304 bool CreateWindowFunction::ShouldOpenIncognitoWindow( 308 bool CreateWindowFunction::ShouldOpenIncognitoWindow(
305 const base::DictionaryValue* args, 309 const base::DictionaryValue* args,
306 std::vector<GURL>* urls, 310 std::vector<GURL>* urls,
307 bool* is_error) { 311 bool* is_error) {
308 *is_error = false; 312 *is_error = false;
309 const IncognitoModePrefs::Availability incognito_availability = 313 const IncognitoModePrefs::Availability incognito_availability =
310 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()); 314 IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 else 528 else
525 window_type = Browser::TYPE_POPUP; 529 window_type = Browser::TYPE_POPUP;
526 } else if (type_str != keys::kWindowTypeValueNormal) { 530 } else if (type_str != keys::kWindowTypeValueNormal) {
527 error_ = keys::kInvalidWindowTypeError; 531 error_ = keys::kInvalidWindowTypeError;
528 return false; 532 return false;
529 } 533 }
530 } 534 }
531 } 535 }
532 536
533 #if defined(USE_AURA) 537 #if defined(USE_AURA)
534 // Aura Panels create a new PanelDOMView. 538 // Aura Panels create a new PanelViewAura.
535 if (CommandLine::ForCurrentProcess()->HasSwitch( 539 if (CommandLine::ForCurrentProcess()->HasSwitch(
536 ash::switches::kAuraPanelManager) && 540 ash::switches::kAuraPanelManager) &&
537 window_type == Browser::TYPE_PANEL) { 541 window_type == Browser::TYPE_PANEL) {
538 // Note: Panels ignore all but the first url provided. 542 // Note: Panels ignore all but the first url provided.
539 std::string title = 543 std::string title =
540 web_app::GenerateApplicationNameFromExtensionId(extension_id); 544 web_app::GenerateApplicationNameFromExtensionId(extension_id);
541 PanelViewAura* panel_view = new PanelViewAura(title); 545 PanelViewAura* panel_view = new PanelViewAura(title);
542 panel_view->Init(window_profile, urls[0], panel_bounds); 546 panel_view->Init(window_profile, urls[0], panel_bounds);
543 // TODO(stevenjb): Provide an interface enable handles for any view, not 547 result_.reset(panel_view->extension_window_wrapper()->
544 // just browsers. See crbug.com/113412. 548 CreateWindowValue(false /*populate_tabs*/));
545 result_.reset(Value::CreateNullValue());
546 return true; 549 return true;
547 } 550 }
548 #endif 551 #endif
549 552
550 // Create a new BrowserWindow. 553 // Create a new BrowserWindow.
551 Browser* new_window; 554 Browser* new_window;
552 if (extension_id.empty()) { 555 if (extension_id.empty()) {
553 new_window = Browser::CreateForType(window_type, window_profile); 556 new_window = Browser::CreateForType(window_type, window_profile);
554 new_window->window()->SetBounds(window_bounds); 557 new_window->window()->SetBounds(window_bounds);
555 } else { 558 } else {
(...skipping 20 matching lines...) Expand all
576 579
577 if (focused) 580 if (focused)
578 new_window->window()->Show(); 581 new_window->window()->Show();
579 else 582 else
580 new_window->window()->ShowInactive(); 583 new_window->window()->ShowInactive();
581 584
582 if (new_window->profile()->IsOffTheRecord() && !include_incognito()) { 585 if (new_window->profile()->IsOffTheRecord() && !include_incognito()) {
583 // Don't expose incognito windows if the extension isn't allowed. 586 // Don't expose incognito windows if the extension isn't allowed.
584 result_.reset(Value::CreateNullValue()); 587 result_.reset(Value::CreateNullValue());
585 } else { 588 } else {
586 result_.reset(ExtensionTabUtil::CreateWindowValue(new_window, true)); 589 result_.reset(new_window->extension_window_wrapper()->
590 CreateWindowValue(true /*populate_tabs*/));
587 } 591 }
588 592
589 return true; 593 return true;
590 } 594 }
591 595
592 bool UpdateWindowFunction::RunImpl() { 596 bool UpdateWindowFunction::RunImpl() {
593 int window_id = extension_misc::kUnknownWindowId; 597 int window_id = extension_misc::kUnknownWindowId;
594 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); 598 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id));
595 DictionaryValue* update_props; 599 DictionaryValue* update_props;
596 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); 600 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props));
597 601
598 Browser* browser = NULL; 602 ExtensionWindowWrapper* wrapper =
599 if (!GetBrowserFromWindowID(this, window_id, &browser)) 603 ExtensionWindowWrapperList::GetInstance()->FindWindowById(
604 profile(), include_incognito(), window_id);
605 if (!wrapper)
600 return false; 606 return false;
601 607
602 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change. 608 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change.
603 std::string state_str; 609 std::string state_str;
604 if (update_props->HasKey(keys::kShowStateKey)) { 610 if (update_props->HasKey(keys::kShowStateKey)) {
605 EXTENSION_FUNCTION_VALIDATE(update_props->GetString(keys::kShowStateKey, 611 EXTENSION_FUNCTION_VALIDATE(update_props->GetString(keys::kShowStateKey,
606 &state_str)); 612 &state_str));
607 if (state_str == keys::kShowStateValueNormal) { 613 if (state_str == keys::kShowStateValueNormal) {
608 show_state = ui::SHOW_STATE_NORMAL; 614 show_state = ui::SHOW_STATE_NORMAL;
609 } else if (state_str == keys::kShowStateValueMinimized) { 615 } else if (state_str == keys::kShowStateValueMinimized) {
610 show_state = ui::SHOW_STATE_MINIMIZED; 616 show_state = ui::SHOW_STATE_MINIMIZED;
611 } else if (state_str == keys::kShowStateValueMaximized) { 617 } else if (state_str == keys::kShowStateValueMaximized) {
612 show_state = ui::SHOW_STATE_MAXIMIZED; 618 show_state = ui::SHOW_STATE_MAXIMIZED;
613 } else { 619 } else {
614 error_ = keys::kInvalidWindowStateError; 620 error_ = keys::kInvalidWindowStateError;
615 return false; 621 return false;
616 } 622 }
617 } 623 }
618 624
619 switch (show_state) { 625 switch (show_state) {
620 case ui::SHOW_STATE_MINIMIZED: 626 case ui::SHOW_STATE_MINIMIZED:
621 browser->window()->Minimize(); 627 wrapper->window()->Minimize();
622 break; 628 break;
623 case ui::SHOW_STATE_MAXIMIZED: 629 case ui::SHOW_STATE_MAXIMIZED:
624 browser->window()->Maximize(); 630 wrapper->window()->Maximize();
625 break; 631 break;
626 case ui::SHOW_STATE_NORMAL: 632 case ui::SHOW_STATE_NORMAL:
627 browser->window()->Restore(); 633 wrapper->window()->Restore();
628 break; 634 break;
629 default: 635 default:
630 break; 636 break;
631 } 637 }
632 638
633 gfx::Rect bounds = browser->window()->GetRestoredBounds(); 639 gfx::Rect bounds = wrapper->window()->GetRestoredBounds();
634 bool set_bounds = false; 640 bool set_bounds = false;
635 641
636 // Any part of the bounds can optionally be set by the caller. 642 // Any part of the bounds can optionally be set by the caller.
637 int bounds_val; 643 int bounds_val;
638 if (update_props->HasKey(keys::kLeftKey)) { 644 if (update_props->HasKey(keys::kLeftKey)) {
639 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( 645 EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger(
640 keys::kLeftKey, 646 keys::kLeftKey,
641 &bounds_val)); 647 &bounds_val));
642 bounds.set_x(bounds_val); 648 bounds.set_x(bounds_val);
643 set_bounds = true; 649 set_bounds = true;
(...skipping 22 matching lines...) Expand all
666 bounds.set_height(bounds_val); 672 bounds.set_height(bounds_val);
667 set_bounds = true; 673 set_bounds = true;
668 } 674 }
669 675
670 if (set_bounds) { 676 if (set_bounds) {
671 if (show_state == ui::SHOW_STATE_MINIMIZED || 677 if (show_state == ui::SHOW_STATE_MINIMIZED ||
672 show_state == ui::SHOW_STATE_MAXIMIZED) { 678 show_state == ui::SHOW_STATE_MAXIMIZED) {
673 error_ = keys::kInvalidWindowStateError; 679 error_ = keys::kInvalidWindowStateError;
674 return false; 680 return false;
675 } 681 }
676 browser->window()->SetBounds(bounds); 682 wrapper->window()->SetBounds(bounds);
677 } 683 }
678 684
679 bool active_val = false; 685 bool active_val = false;
680 if (update_props->HasKey(keys::kFocusedKey)) { 686 if (update_props->HasKey(keys::kFocusedKey)) {
681 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( 687 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean(
682 keys::kFocusedKey, &active_val)); 688 keys::kFocusedKey, &active_val));
683 if (active_val) { 689 if (active_val) {
684 if (show_state == ui::SHOW_STATE_MINIMIZED) { 690 if (show_state == ui::SHOW_STATE_MINIMIZED) {
685 error_ = keys::kInvalidWindowStateError; 691 error_ = keys::kInvalidWindowStateError;
686 return false; 692 return false;
687 } 693 }
688 browser->window()->Activate(); 694 wrapper->window()->Activate();
689 } else { 695 } else {
690 if (show_state == ui::SHOW_STATE_MAXIMIZED) { 696 if (show_state == ui::SHOW_STATE_MAXIMIZED) {
691 error_ = keys::kInvalidWindowStateError; 697 error_ = keys::kInvalidWindowStateError;
692 return false; 698 return false;
693 } 699 }
694 browser->window()->Deactivate(); 700 wrapper->window()->Deactivate();
695 } 701 }
696 } 702 }
697 703
698 bool draw_attention = false; 704 bool draw_attention = false;
699 if (update_props->HasKey(keys::kDrawAttentionKey)) { 705 if (update_props->HasKey(keys::kDrawAttentionKey)) {
700 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( 706 EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean(
701 keys::kDrawAttentionKey, &draw_attention)); 707 keys::kDrawAttentionKey, &draw_attention));
702 browser->window()->FlashFrame(draw_attention); 708 wrapper->window()->FlashFrame(draw_attention);
703 } 709 }
704 710
705 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); 711 result_.reset(wrapper->CreateWindowValue(false /*populate_tabs*/));
706 712
707 return true; 713 return true;
708 } 714 }
709 715
710 bool RemoveWindowFunction::RunImpl() { 716 bool RemoveWindowFunction::RunImpl() {
711 int window_id = -1; 717 int window_id = -1;
712 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); 718 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id));
713 719
714 Browser* browser = GetBrowserInProfileWithId(profile(), window_id, 720 ExtensionWindowWrapper* wrapper =
715 include_incognito(), &error_); 721 ExtensionWindowWrapperList::GetInstance()->FindWindowById(
716 if (!browser) 722 profile(), include_incognito(), window_id);
717 return false; 723 if (wrapper == NULL) {
718 724 error_ = ExtensionErrorUtils::FormatErrorMessage(
719 // Don't let the extension remove the window if the user is dragging tabs 725 keys::kWindowNotFoundError, base::IntToString(window_id));
720 // in that window.
721 if (!browser->IsTabStripEditable()) {
722 error_ = keys::kTabStripNotEditableError;
723 return false; 726 return false;
724 } 727 }
725 728 ExtensionWindowWrapper::Reason reason;
726 browser->CloseWindow(); 729 if (!wrapper->CanClose(&reason)) {
727 730 if (reason == ExtensionWindowWrapper::REASON_TAB_STRIP_NOT_EDITABLE)
731 error_ = keys::kTabStripNotEditableError;
732 return false;
733 }
734 wrapper->window()->Close();
728 return true; 735 return true;
729 } 736 }
730 737
731 // Tabs ------------------------------------------------------------------------ 738 // Tabs ------------------------------------------------------------------------
732 739
733 bool GetSelectedTabFunction::RunImpl() { 740 bool GetSelectedTabFunction::RunImpl() {
734 // windowId defaults to "current" window. 741 // windowId defaults to "current" window.
735 int window_id = extension_misc::kCurrentWindowId; 742 int window_id = extension_misc::kCurrentWindowId;
736 743
737 if (HasOptionalArgument(0)) 744 if (HasOptionalArgument(0))
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 } 1072 }
1066 1073
1067 // Make sure they actually specified tabs to select. 1074 // Make sure they actually specified tabs to select.
1068 if (selection.empty()) { 1075 if (selection.empty()) {
1069 error_ = keys::kNoHighlightedTabError; 1076 error_ = keys::kNoHighlightedTabError;
1070 return false; 1077 return false;
1071 } 1078 }
1072 1079
1073 selection.set_active(active_index); 1080 selection.set_active(active_index);
1074 browser->tabstrip_model()->SetSelectionFromModel(selection); 1081 browser->tabstrip_model()->SetSelectionFromModel(selection);
1075 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, true)); 1082 result_.reset(browser->extension_window_wrapper()->
1083 CreateWindowValue(true /*populate_tabs*/));
1076 return true; 1084 return true;
1077 } 1085 }
1078 1086
1079 UpdateTabFunction::UpdateTabFunction() : web_contents_(NULL) { 1087 UpdateTabFunction::UpdateTabFunction() : web_contents_(NULL) {
1080 } 1088 }
1081 1089
1082 bool UpdateTabFunction::RunImpl() { 1090 bool UpdateTabFunction::RunImpl() {
1083 DictionaryValue* update_props = NULL; 1091 DictionaryValue* update_props = NULL;
1084 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); 1092 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props));
1085 1093
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 // called for every API call the extension made. 1731 // called for every API call the extension made.
1724 GotLanguage(language); 1732 GotLanguage(language);
1725 } 1733 }
1726 1734
1727 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1735 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1728 result_.reset(Value::CreateStringValue(language.c_str())); 1736 result_.reset(Value::CreateStringValue(language.c_str()));
1729 SendResponse(true); 1737 SendResponse(true);
1730 1738
1731 Release(); // Balanced in Run() 1739 Release(); // Balanced in Run()
1732 } 1740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698