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/ui/webui/extensions/pack_extension_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_creator.h" | 7 #include "chrome/browser/extensions/extension_creator.h" |
8 #include "chrome/browser/ui/chrome_select_file_policy.h" | 8 #include "chrome/browser/ui/chrome_select_file_policy.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_contents_view.h" | 12 #include "content/public/browser/web_contents_view.h" |
13 #include "content/public/browser/web_ui.h" | 13 #include "content/public/browser/web_ui.h" |
14 #include "content/public/browser/web_ui_data_source.h" | 14 #include "content/public/browser/web_ui_data_source.h" |
15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 | 17 |
18 PackExtensionHandler::PackExtensionHandler() { | 18 PackExtensionHandler::PackExtensionHandler() { |
19 } | 19 } |
20 | 20 |
21 PackExtensionHandler::~PackExtensionHandler() { | 21 PackExtensionHandler::~PackExtensionHandler() { |
22 // There may be pending file dialogs, we need to tell them that we've gone | 22 // There may be pending file dialogs, we need to tell them that we've gone |
23 // away so they don't try and call back to us. | 23 // away so they don't try and call back to us. |
24 if (load_extension_dialog_) | 24 if (load_extension_dialog_.get()) |
25 load_extension_dialog_->ListenerDestroyed(); | 25 load_extension_dialog_->ListenerDestroyed(); |
26 | 26 |
27 if (pack_job_.get()) | 27 if (pack_job_.get()) |
28 pack_job_->ClearClient(); | 28 pack_job_->ClearClient(); |
29 } | 29 } |
30 | 30 |
31 void PackExtensionHandler::GetLocalizedValues( | 31 void PackExtensionHandler::GetLocalizedValues( |
32 content::WebUIDataSource* source) { | 32 content::WebUIDataSource* source) { |
33 source->AddString("packExtensionOverlay", | 33 source->AddString("packExtensionOverlay", |
34 l10n_util::GetStringUTF16(IDS_EXTENSION_PACK_DIALOG_TITLE)); | 34 l10n_util::GetStringUTF16(IDS_EXTENSION_PACK_DIALOG_TITLE)); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 base::FilePath::StringType(), | 192 base::FilePath::StringType(), |
193 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), | 193 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), |
194 NULL); | 194 NULL); |
195 } | 195 } |
196 | 196 |
197 void PackExtensionHandler::ShowAlert(const std::string& message) { | 197 void PackExtensionHandler::ShowAlert(const std::string& message) { |
198 ListValue arguments; | 198 ListValue arguments; |
199 arguments.Append(Value::CreateStringValue(message)); | 199 arguments.Append(Value::CreateStringValue(message)); |
200 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); | 200 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); |
201 } | 201 } |
OLD | NEW |