OLD | NEW |
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/offscreen_tabs/offscreen_tabs_api.h" | 5 #include "chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 result_.reset(offscreen_tab->CreateValue()); | 537 result_.reset(offscreen_tab->CreateValue()); |
538 return true; | 538 return true; |
539 } | 539 } |
540 | 540 |
541 GetAllOffscreenTabFunction::GetAllOffscreenTabFunction() {} | 541 GetAllOffscreenTabFunction::GetAllOffscreenTabFunction() {} |
542 GetAllOffscreenTabFunction::~GetAllOffscreenTabFunction() {} | 542 GetAllOffscreenTabFunction::~GetAllOffscreenTabFunction() {} |
543 | 543 |
544 bool GetAllOffscreenTabFunction::RunImpl() { | 544 bool GetAllOffscreenTabFunction::RunImpl() { |
545 WebContents* web_contents = GetCurrentWebContents(this, &error_); | 545 WebContents* web_contents = GetCurrentWebContents(this, &error_); |
546 if (!web_contents) | 546 if (!web_contents) |
547 return NULL; | 547 return false; |
548 | 548 |
549 ParentTab* parent_tab = GetMap()->GetParentTab(web_contents, extension_id()); | 549 ParentTab* parent_tab = GetMap()->GetParentTab(web_contents, extension_id()); |
550 ListValue* tab_list = new ListValue(); | 550 ListValue* tab_list = new ListValue(); |
551 if (parent_tab) { | 551 if (parent_tab) { |
552 for (OffscreenTabs::const_iterator i = parent_tab->offscreen_tabs().begin(); | 552 for (OffscreenTabs::const_iterator i = parent_tab->offscreen_tabs().begin(); |
553 i != parent_tab->offscreen_tabs().end(); ++i) | 553 i != parent_tab->offscreen_tabs().end(); ++i) |
554 tab_list->Append((*i)->CreateValue()); | 554 tab_list->Append((*i)->CreateValue()); |
555 } | 555 } |
556 | 556 |
557 result_.reset(tab_list); | 557 result_.reset(tab_list); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 // async case (when a "javascript": URL is sent to a tab). | 831 // async case (when a "javascript": URL is sent to a tab). |
832 if (!is_async) | 832 if (!is_async) |
833 SendResponse(true); | 833 SendResponse(true); |
834 | 834 |
835 return true; | 835 return true; |
836 } | 836 } |
837 | 837 |
838 void UpdateOffscreenTabFunction::PopulateResult() { | 838 void UpdateOffscreenTabFunction::PopulateResult() { |
839 // There's no result associated with this callback. | 839 // There's no result associated with this callback. |
840 } | 840 } |
OLD | NEW |