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

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

Issue 7635019: Set Extension Infobars to have a fixed height determined by the developer (clamped to sane min an... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_infobar_module.h" 5 #include "chrome/browser/extensions/extension_infobar_module.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/extensions/extension_host.h" 10 #include "chrome/browser/extensions/extension_host.h"
(...skipping 15 matching lines...) Expand all
26 bool ShowInfoBarFunction::RunImpl() { 26 bool ShowInfoBarFunction::RunImpl() {
27 DictionaryValue* args; 27 DictionaryValue* args;
28 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); 28 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args));
29 29
30 int tab_id; 30 int tab_id;
31 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kTabId, &tab_id)); 31 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kTabId, &tab_id));
32 32
33 std::string html_path; 33 std::string html_path;
34 EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kHtmlPath, &html_path)); 34 EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kHtmlPath, &html_path));
35 35
36 int height;
37 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kHeight, &height));
38
36 const Extension* extension = GetExtension(); 39 const Extension* extension = GetExtension();
37 GURL url = extension->GetResourceURL(extension->url(), html_path); 40 GURL url = extension->GetResourceURL(extension->url(), html_path);
38 41
39 Browser* browser = NULL; 42 Browser* browser = NULL;
40 TabContentsWrapper* tab_contents = NULL; 43 TabContentsWrapper* tab_contents = NULL;
41 if (!ExtensionTabUtil::GetTabById( 44 if (!ExtensionTabUtil::GetTabById(
42 tab_id, 45 tab_id,
43 profile(), 46 profile(),
44 include_incognito(), 47 include_incognito(),
45 &browser, 48 &browser,
46 NULL, 49 NULL,
47 &tab_contents, 50 &tab_contents,
48 NULL)) { 51 NULL)) {
49 error_ = ExtensionErrorUtils::FormatErrorMessage( 52 error_ = ExtensionErrorUtils::FormatErrorMessage(
50 extension_tabs_module_constants::kTabNotFoundError, 53 extension_tabs_module_constants::kTabNotFoundError,
51 base::IntToString(tab_id)); 54 base::IntToString(tab_id));
52 return false; 55 return false;
53 } 56 }
54 57
55 tab_contents->AddInfoBar( 58 tab_contents->AddInfoBar(
56 new ExtensionInfoBarDelegate(browser, tab_contents->tab_contents(), 59 new ExtensionInfoBarDelegate(browser, tab_contents->tab_contents(),
57 GetExtension(), url)); 60 GetExtension(), url, height));
58 61
59 // TODO(finnur): Return the actual DOMWindow object. Bug 26463. 62 // TODO(finnur): Return the actual DOMWindow object. Bug 26463.
60 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); 63 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false));
61 64
62 return true; 65 return true;
63 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698