OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/extensions/extension_installed_bubble_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 close_button_->SetImage(views::CustomButton::STATE_NORMAL, | 227 close_button_->SetImage(views::CustomButton::STATE_NORMAL, |
228 rb.GetImageSkiaNamed(IDR_CLOSE_2)); | 228 rb.GetImageSkiaNamed(IDR_CLOSE_2)); |
229 close_button_->SetImage(views::CustomButton::STATE_HOVERED, | 229 close_button_->SetImage(views::CustomButton::STATE_HOVERED, |
230 rb.GetImageSkiaNamed(IDR_CLOSE_2_H)); | 230 rb.GetImageSkiaNamed(IDR_CLOSE_2_H)); |
231 close_button_->SetImage(views::CustomButton::STATE_PRESSED, | 231 close_button_->SetImage(views::CustomButton::STATE_PRESSED, |
232 rb.GetImageSkiaNamed(IDR_CLOSE_2_P)); | 232 rb.GetImageSkiaNamed(IDR_CLOSE_2_P)); |
233 AddChildView(close_button_); | 233 AddChildView(close_button_); |
234 } | 234 } |
235 | 235 |
236 virtual void ButtonPressed(views::Button* sender, | 236 virtual void ButtonPressed(views::Button* sender, |
237 const ui::Event& event) OVERRIDE { | 237 const ui::Event& event) override { |
238 DCHECK_EQ(sender, close_button_); | 238 DCHECK_EQ(sender, close_button_); |
239 GetWidget()->Close(); | 239 GetWidget()->Close(); |
240 } | 240 } |
241 | 241 |
242 // Implements the views::LinkListener interface. | 242 // Implements the views::LinkListener interface. |
243 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE { | 243 virtual void LinkClicked(views::Link* source, int event_flags) override { |
244 GetWidget()->Close(); | 244 GetWidget()->Close(); |
245 std::string configure_url; | 245 std::string configure_url; |
246 if (source == manage_shortcut_) { | 246 if (source == manage_shortcut_) { |
247 configure_url = chrome::kChromeUIExtensionsURL; | 247 configure_url = chrome::kChromeUIExtensionsURL; |
248 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 248 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
249 } else if (source == sign_in_link_) { | 249 } else if (source == sign_in_link_) { |
250 configure_url = signin::GetPromoURL( | 250 configure_url = signin::GetPromoURL( |
251 signin::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); | 251 signin::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); |
252 } else { | 252 } else { |
253 NOTREACHED(); | 253 NOTREACHED(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 // The link is drawn separately; make it transparent here to only draw once. | 368 // The link is drawn separately; make it transparent here to only draw once. |
369 // The link always leads other text and is assumed to fit on the first line. | 369 // The link always leads other text and is assumed to fit on the first line. |
370 sign_in_promo_lines_.front()->ApplyColor(SK_ColorTRANSPARENT, | 370 sign_in_promo_lines_.front()->ApplyColor(SK_ColorTRANSPARENT, |
371 gfx::Range(0, signin_promo_link_text_.size())); | 371 gfx::Range(0, signin_promo_link_text_.size())); |
372 | 372 |
373 return height; | 373 return height; |
374 } | 374 } |
375 | 375 |
376 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 376 virtual gfx::Size GetPreferredSize() const override { |
377 int width = kHorizOuterMargin; | 377 int width = kHorizOuterMargin; |
378 width += kIconSize; | 378 width += kIconSize; |
379 width += views::kPanelHorizMargin; | 379 width += views::kPanelHorizMargin; |
380 width += kRightColumnWidth; | 380 width += kRightColumnWidth; |
381 width += 2 * views::kPanelHorizMargin; | 381 width += 2 * views::kPanelHorizMargin; |
382 width += kHorizOuterMargin; | 382 width += kHorizOuterMargin; |
383 | 383 |
384 int height = kVertOuterMargin; | 384 int height = kVertOuterMargin; |
385 height += heading_->GetHeightForWidth(kRightColumnWidth); | 385 height += heading_->GetHeightForWidth(kRightColumnWidth); |
386 height += kVertInnerMargin; | 386 height += kVertInnerMargin; |
(...skipping 14 matching lines...) Expand all Loading... |
401 } | 401 } |
402 | 402 |
403 if (flavors_ & SHOW_KEYBINDING) { | 403 if (flavors_ & SHOW_KEYBINDING) { |
404 height += manage_shortcut_->GetHeightForWidth(kRightColumnWidth); | 404 height += manage_shortcut_->GetHeightForWidth(kRightColumnWidth); |
405 height += kVertInnerMargin; | 405 height += kVertInnerMargin; |
406 } | 406 } |
407 | 407 |
408 return gfx::Size(width, std::max(height, kIconSize + 2 * kVertOuterMargin)); | 408 return gfx::Size(width, std::max(height, kIconSize + 2 * kVertOuterMargin)); |
409 } | 409 } |
410 | 410 |
411 virtual void Layout() OVERRIDE { | 411 virtual void Layout() override { |
412 int x = kHorizOuterMargin; | 412 int x = kHorizOuterMargin; |
413 int y = kVertOuterMargin; | 413 int y = kVertOuterMargin; |
414 | 414 |
415 icon_->SetBounds(x, y, kIconSize, kIconSize); | 415 icon_->SetBounds(x, y, kIconSize, kIconSize); |
416 x += kIconSize; | 416 x += kIconSize; |
417 x += views::kPanelHorizMargin; | 417 x += views::kPanelHorizMargin; |
418 | 418 |
419 y += kRightcolumnVerticalShift; | 419 y += kRightcolumnVerticalShift; |
420 heading_->SizeToFit(kRightColumnWidth); | 420 heading_->SizeToFit(kRightColumnWidth); |
421 heading_->SetX(x); | 421 heading_->SetX(x); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 gfx::Size sz; | 458 gfx::Size sz; |
459 x += kRightColumnWidth + 2 * views::kPanelHorizMargin + kHorizOuterMargin - | 459 x += kRightColumnWidth + 2 * views::kPanelHorizMargin + kHorizOuterMargin - |
460 close_button_->GetPreferredSize().width(); | 460 close_button_->GetPreferredSize().width(); |
461 y = kVertOuterMargin; | 461 y = kVertOuterMargin; |
462 sz = close_button_->GetPreferredSize(); | 462 sz = close_button_->GetPreferredSize(); |
463 // x-1 & y-1 is just slop to get the close button visually aligned with the | 463 // x-1 & y-1 is just slop to get the close button visually aligned with the |
464 // title text and bubble arrow. | 464 // title text and bubble arrow. |
465 close_button_->SetBounds(x - 1, y - 1, sz.width(), sz.height()); | 465 close_button_->SetBounds(x - 1, y - 1, sz.width(), sz.height()); |
466 } | 466 } |
467 | 467 |
468 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 468 virtual void OnPaint(gfx::Canvas* canvas) override { |
469 for (ScopedVector<gfx::RenderText>::const_iterator it = | 469 for (ScopedVector<gfx::RenderText>::const_iterator it = |
470 sign_in_promo_lines_.begin(); | 470 sign_in_promo_lines_.begin(); |
471 it != sign_in_promo_lines_.end(); ++it) | 471 it != sign_in_promo_lines_.end(); ++it) |
472 (*it)->Draw(canvas); | 472 (*it)->Draw(canvas); |
473 | 473 |
474 views::View::OnPaint(canvas); | 474 views::View::OnPaint(canvas); |
475 } | 475 } |
476 | 476 |
477 // The browser we're associated with. | 477 // The browser we're associated with. |
478 Browser* browser_; | 478 Browser* browser_; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void ExtensionInstalledBubbleView::WindowClosing() { | 597 void ExtensionInstalledBubbleView::WindowClosing() { |
598 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { | 598 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { |
599 BrowserView* browser_view = | 599 BrowserView* browser_view = |
600 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 600 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
601 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 601 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
602 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 602 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
603 GetPageAction(*bubble_.extension()), | 603 GetPageAction(*bubble_.extension()), |
604 false); // preview_enabled | 604 false); // preview_enabled |
605 } | 605 } |
606 } | 606 } |
OLD | NEW |