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

Side by Side Diff: chrome/browser/infobars/infobar_extension_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
« no previous file with comments | « chrome/browser/extensions/extension_tab_util_android.cc ('k') | no next file » | 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) 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/infobars/infobar_extension_api.h" 5 #include "chrome/browser/infobars/infobar_extension_api.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
11 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 11 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
12 #include "chrome/browser/extensions/extension_host.h" 12 #include "chrome/browser/extensions/extension_host.h"
13 #include "chrome/browser/extensions/extension_infobar_delegate.h" 13 #include "chrome/browser/extensions/extension_infobar_delegate.h"
14 #include "chrome/browser/extensions/extension_tab_util.h" 14 #include "chrome/browser/extensions/extension_tab_util.h"
15 #include "chrome/browser/extensions/window_controller.h" 15 #include "chrome/browser/extensions/window_controller.h"
16 #include "chrome/browser/infobars/infobar_tab_helper.h" 16 #include "chrome/browser/infobars/infobar_tab_helper.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
20 #include "chrome/common/extensions/extension_error_utils.h" 19 #include "chrome/common/extensions/extension_error_utils.h"
21 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
24 23
25 using extensions::Extension; 24 using extensions::Extension;
26 25
27 namespace { 26 namespace {
28 27
(...skipping 17 matching lines...) Expand all
46 EXTENSION_FUNCTION_VALIDATE(args->GetString(kHtmlPath, &html_path)); 45 EXTENSION_FUNCTION_VALIDATE(args->GetString(kHtmlPath, &html_path));
47 46
48 int height = 0; 47 int height = 0;
49 if (args->HasKey(kHeight)) 48 if (args->HasKey(kHeight))
50 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(kHeight, &height)); 49 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(kHeight, &height));
51 50
52 const Extension* extension = GetExtension(); 51 const Extension* extension = GetExtension();
53 GURL url = extension->GetResourceURL(extension->url(), html_path); 52 GURL url = extension->GetResourceURL(extension->url(), html_path);
54 53
55 Browser* browser = NULL; 54 Browser* browser = NULL;
56 TabContents* tab_contents = NULL; 55 content::WebContents* web_contents = NULL;
57 if (!ExtensionTabUtil::GetTabById( 56 if (!ExtensionTabUtil::GetTabById(
58 tab_id, 57 tab_id,
59 profile(), 58 profile(),
60 include_incognito(), 59 include_incognito(),
61 &browser, 60 &browser,
62 NULL, 61 NULL,
63 &tab_contents, 62 &web_contents,
64 NULL)) { 63 NULL)) {
65 error_ = ExtensionErrorUtils::FormatErrorMessage( 64 error_ = ExtensionErrorUtils::FormatErrorMessage(
66 extensions::tabs_constants::kTabNotFoundError, 65 extensions::tabs_constants::kTabNotFoundError,
67 base::IntToString(tab_id)); 66 base::IntToString(tab_id));
68 return false; 67 return false;
69 } 68 }
70 69
71 InfoBarTabHelper* infobar_tab_helper = 70 InfoBarTabHelper* infobar_tab_helper =
72 InfoBarTabHelper::FromWebContents(tab_contents->web_contents()); 71 InfoBarTabHelper::FromWebContents(web_contents);
73 infobar_tab_helper->AddInfoBar( 72 infobar_tab_helper->AddInfoBar(
74 new ExtensionInfoBarDelegate(browser, infobar_tab_helper, 73 new ExtensionInfoBarDelegate(browser, infobar_tab_helper,
75 GetExtension(), url, height)); 74 GetExtension(), url, height));
76 75
77 // TODO(finnur): Return the actual DOMWindow object. Bug 26463. 76 // TODO(finnur): Return the actual DOMWindow object. Bug 26463.
78 DCHECK(browser->extension_window_controller()); 77 DCHECK(browser->extension_window_controller());
79 SetResult(browser->extension_window_controller()->CreateWindowValue()); 78 SetResult(browser->extension_window_controller()->CreateWindowValue());
80 79
81 return true; 80 return true;
82 } 81 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_util_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698