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

Side by Side Diff: chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc

Issue 11308012: Remove some TabContentses from extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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 | Annotate | Revision Log
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/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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &offscreen_tab_id)); 800 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &offscreen_tab_id));
801 801
802 OffscreenTab* offscreen_tab = NULL; 802 OffscreenTab* offscreen_tab = NULL;
803 if (!GetMap()->GetOffscreenTab( 803 if (!GetMap()->GetOffscreenTab(
804 offscreen_tab_id, this, &offscreen_tab, &error_)) 804 offscreen_tab_id, this, &offscreen_tab, &error_))
805 return false; 805 return false;
806 806
807 DictionaryValue* update_props; 807 DictionaryValue* update_props;
808 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); 808 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props));
809 809
810 tab_contents_ = offscreen_tab->tab_contents(); 810 web_contents_ = offscreen_tab->tab_contents()->web_contents();
811 bool is_async = false; 811 bool is_async = false;
812 if (!UpdateURLIfPresent(update_props, offscreen_tab_id, &is_async)) 812 if (!UpdateURLIfPresent(update_props, offscreen_tab_id, &is_async))
813 return false; 813 return false;
814 814
815 // Update the width and height, if specified. 815 // Update the width and height, if specified.
816 if (update_props->HasKey(tabs_keys::kWidthKey) || 816 if (update_props->HasKey(tabs_keys::kWidthKey) ||
817 update_props->HasKey(tabs_keys::kHeightKey)) { 817 update_props->HasKey(tabs_keys::kHeightKey)) {
818 const gfx::Size& size = 818 const gfx::Size& size = web_contents_->GetView()->GetContainerSize();
819 tab_contents_->web_contents()->GetView()->GetContainerSize();
820 819
821 int width; 820 int width;
822 if (update_props->HasKey(tabs_keys::kWidthKey)) 821 if (update_props->HasKey(tabs_keys::kWidthKey))
823 EXTENSION_FUNCTION_VALIDATE( 822 EXTENSION_FUNCTION_VALIDATE(
824 update_props->GetInteger(tabs_keys::kWidthKey, &width)); 823 update_props->GetInteger(tabs_keys::kWidthKey, &width));
825 else 824 else
826 width = size.width(); 825 width = size.width();
827 826
828 int height; 827 int height;
829 if (update_props->HasKey(tabs_keys::kHeightKey)) 828 if (update_props->HasKey(tabs_keys::kHeightKey))
830 EXTENSION_FUNCTION_VALIDATE( 829 EXTENSION_FUNCTION_VALIDATE(
831 update_props->GetInteger(tabs_keys::kHeightKey, &height)); 830 update_props->GetInteger(tabs_keys::kHeightKey, &height));
832 else 831 else
833 height = size.height(); 832 height = size.height();
834 833
835 offscreen_tab->SetSize(width, height); 834 offscreen_tab->SetSize(width, height);
836 } 835 }
837 836
838 // The response is sent from UpdateTabFunction::OnExecuteCodeFinish in the 837 // The response is sent from UpdateTabFunction::OnExecuteCodeFinish in the
839 // async case (when a "javascript": URL is sent to a tab). 838 // async case (when a "javascript": URL is sent to a tab).
840 if (!is_async) 839 if (!is_async)
841 SendResponse(true); 840 SendResponse(true);
842 841
843 return true; 842 return true;
844 } 843 }
845 844
846 void UpdateOffscreenTabFunction::PopulateResult() { 845 void UpdateOffscreenTabFunction::PopulateResult() {
847 // There's no result associated with this callback. 846 // There's no result associated with this callback.
848 } 847 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698