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

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 = 0;
37 if (args->HasKey(keys::kHeight))
38 EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kHeight, &height));
39
36 const Extension* extension = GetExtension(); 40 const Extension* extension = GetExtension();
37 GURL url = extension->GetResourceURL(extension->url(), html_path); 41 GURL url = extension->GetResourceURL(extension->url(), html_path);
38 42
39 Browser* browser = NULL; 43 Browser* browser = NULL;
40 TabContentsWrapper* tab_contents = NULL; 44 TabContentsWrapper* tab_contents = NULL;
41 if (!ExtensionTabUtil::GetTabById( 45 if (!ExtensionTabUtil::GetTabById(
42 tab_id, 46 tab_id,
43 profile(), 47 profile(),
44 include_incognito(), 48 include_incognito(),
45 &browser, 49 &browser,
46 NULL, 50 NULL,
47 &tab_contents, 51 &tab_contents,
48 NULL)) { 52 NULL)) {
49 error_ = ExtensionErrorUtils::FormatErrorMessage( 53 error_ = ExtensionErrorUtils::FormatErrorMessage(
50 extension_tabs_module_constants::kTabNotFoundError, 54 extension_tabs_module_constants::kTabNotFoundError,
51 base::IntToString(tab_id)); 55 base::IntToString(tab_id));
52 return false; 56 return false;
53 } 57 }
54 58
55 tab_contents->AddInfoBar( 59 tab_contents->AddInfoBar(
56 new ExtensionInfoBarDelegate(browser, tab_contents->tab_contents(), 60 new ExtensionInfoBarDelegate(browser, tab_contents->tab_contents(),
57 GetExtension(), url)); 61 GetExtension(), url, height));
58 62
59 // TODO(finnur): Return the actual DOMWindow object. Bug 26463. 63 // TODO(finnur): Return the actual DOMWindow object. Bug 26463.
60 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false)); 64 result_.reset(ExtensionTabUtil::CreateWindowValue(browser, false));
61 65
62 return true; 66 return true;
63 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698