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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/extensions/bundle_installer.h" | 12 #include "chrome/browser/extensions/bundle_installer.h" |
13 #include "chrome/browser/extensions/extension_install_dialog.h" | 13 #include "chrome/browser/extensions/extension_install_prompt.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "content/public/browser/page_navigator.h" | 16 #include "content/public/browser/page_navigator.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
19 #include "ui/base/animation/animation_delegate.h" | 19 #include "ui/base/animation/animation_delegate.h" |
20 #include "ui/base/animation/slide_animation.h" | 20 #include "ui/base/animation/slide_animation.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 #include "ui/gfx/point3.h" | 23 #include "ui/gfx/point3.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 DetailsView* details_view_; | 165 DetailsView* details_view_; |
166 | 166 |
167 // The '>' zippy control. | 167 // The '>' zippy control. |
168 views::ImageView* arrow_view_; | 168 views::ImageView* arrow_view_; |
169 | 169 |
170 ui::SlideAnimation slide_animation_; | 170 ui::SlideAnimation slide_animation_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(IssueAdviceView); | 172 DISALLOW_COPY_AND_ASSIGN(IssueAdviceView); |
173 }; | 173 }; |
174 | 174 |
| 175 void ShowExtensionInstallDialogImpl( |
| 176 gfx::NativeWindow parent, |
| 177 content::PageNavigator* navigator, |
| 178 ExtensionInstallPrompt::Delegate* delegate, |
| 179 const ExtensionInstallPrompt::Prompt& prompt) { |
| 180 views::Widget::CreateWindowWithParent( |
| 181 new ExtensionInstallDialogView(navigator, delegate, prompt), |
| 182 parent)->Show(); |
| 183 } |
| 184 |
175 } // namespace | 185 } // namespace |
176 | 186 |
177 ExtensionInstallDialogView::ExtensionInstallDialogView( | 187 ExtensionInstallDialogView::ExtensionInstallDialogView( |
178 content::PageNavigator* navigator, | 188 content::PageNavigator* navigator, |
179 ExtensionInstallPrompt::Delegate* delegate, | 189 ExtensionInstallPrompt::Delegate* delegate, |
180 const ExtensionInstallPrompt::Prompt& prompt) | 190 const ExtensionInstallPrompt::Prompt& prompt) |
181 : navigator_(navigator), | 191 : navigator_(navigator), |
182 delegate_(delegate), | 192 delegate_(delegate), |
183 prompt_(prompt) { | 193 prompt_(prompt) { |
184 // Possible grid layouts: | 194 // Possible grid layouts: |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 int event_flags) { | 479 int event_flags) { |
470 GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() + | 480 GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() + |
471 prompt_.extension()->id()); | 481 prompt_.extension()->id()); |
472 OpenURLParams params( | 482 OpenURLParams params( |
473 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, | 483 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, |
474 false); | 484 false); |
475 navigator_->OpenURL(params); | 485 navigator_->OpenURL(params); |
476 GetWidget()->Close(); | 486 GetWidget()->Close(); |
477 } | 487 } |
478 | 488 |
479 void ShowExtensionInstallDialogImpl( | 489 // static |
480 gfx::NativeWindow parent, | 490 ExtensionInstallPrompt::ShowDialogCallback |
481 content::PageNavigator* navigator, | 491 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { |
482 ExtensionInstallPrompt::Delegate* delegate, | 492 return base::Bind(&ShowExtensionInstallDialogImpl); |
483 const ExtensionInstallPrompt::Prompt& prompt) { | |
484 views::Widget::CreateWindowWithParent( | |
485 new ExtensionInstallDialogView(navigator, delegate, prompt), | |
486 parent)->Show(); | |
487 } | 493 } |
488 | 494 |
489 // IssueAdviceView::DetailsView ------------------------------------------------ | 495 // IssueAdviceView::DetailsView ------------------------------------------------ |
490 | 496 |
491 IssueAdviceView::DetailsView::DetailsView(int horizontal_space) | 497 IssueAdviceView::DetailsView::DetailsView(int horizontal_space) |
492 : layout_(new views::GridLayout(this)), | 498 : layout_(new views::GridLayout(this)), |
493 state_(0) { | 499 state_(0) { |
494 SetLayoutManager(layout_); | 500 SetLayoutManager(layout_); |
495 views::ColumnSet* column_set = layout_->AddColumnSet(0); | 501 views::ColumnSet* column_set = layout_->AddColumnSet(0); |
496 column_set->AddColumn(views::GridLayout::LEADING, | 502 column_set->AddColumn(views::GridLayout::LEADING, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 rotate.ConcatTranslate(arrow_view_->width() / 2.0, | 617 rotate.ConcatTranslate(arrow_view_->width() / 2.0, |
612 arrow_view_->height() / 2.0); | 618 arrow_view_->height() / 2.0); |
613 } | 619 } |
614 arrow_view_->SetTransform(rotate); | 620 arrow_view_->SetTransform(rotate); |
615 } | 621 } |
616 } | 622 } |
617 | 623 |
618 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { | 624 void IssueAdviceView::ChildPreferredSizeChanged(views::View* child) { |
619 owner_->SizeToContents(); | 625 owner_->SizeToContents(); |
620 } | 626 } |
OLD | NEW |