| 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/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 13 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" | |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 16 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" | 15 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" |
| 17 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" | 16 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" |
| 18 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 19 #include "content/public/browser/web_contents_view.h" | 18 #include "content/public/browser/web_contents_view.h" |
| 20 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/models/combobox_model.h" | 21 #include "ui/base/models/combobox_model.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 virtual int GetDefaultIndex() const OVERRIDE { return 0; } | 68 virtual int GetDefaultIndex() const OVERRIDE { return 0; } |
| 70 | 69 |
| 71 std::vector<base::string16> items_; | 70 std::vector<base::string16> items_; |
| 72 | 71 |
| 73 DISALLOW_COPY_AND_ASSIGN(SavePasswordRefusalComboboxModel); | 72 DISALLOW_COPY_AND_ASSIGN(SavePasswordRefusalComboboxModel); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace | 75 } // namespace |
| 77 | 76 |
| 78 | 77 |
| 79 // Globals -------------------------------------------------------------------- | |
| 80 | |
| 81 namespace chrome { | |
| 82 | |
| 83 void ShowManagePasswordsBubble(content::WebContents* web_contents) { | |
| 84 ManagePasswordsBubbleUIController* controller = | |
| 85 ManagePasswordsBubbleUIController::FromWebContents(web_contents); | |
| 86 ManagePasswordsBubbleView::ShowBubble( | |
| 87 web_contents, | |
| 88 controller->manage_passwords_bubble_needs_showing() ? | |
| 89 ManagePasswordsBubbleView::AUTOMATIC : | |
| 90 ManagePasswordsBubbleView::USER_ACTION); | |
| 91 } | |
| 92 | |
| 93 } // namespace chrome | |
| 94 | |
| 95 | |
| 96 // ManagePasswordsBubbleView -------------------------------------------------- | 78 // ManagePasswordsBubbleView -------------------------------------------------- |
| 97 | 79 |
| 98 // static | 80 // static |
| 99 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = | 81 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = |
| 100 NULL; | 82 NULL; |
| 101 | 83 |
| 102 // static | 84 // static |
| 103 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, | 85 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, |
| 104 DisplayReason reason) { | 86 DisplayReason reason) { |
| 105 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 87 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 break; | 362 break; |
| 381 case SavePasswordRefusalComboboxModel::INDEX_NEVER_FOR_THIS_SITE: | 363 case SavePasswordRefusalComboboxModel::INDEX_NEVER_FOR_THIS_SITE: |
| 382 model()->OnNeverForThisSiteClicked(); | 364 model()->OnNeverForThisSiteClicked(); |
| 383 break; | 365 break; |
| 384 default: | 366 default: |
| 385 NOTREACHED(); | 367 NOTREACHED(); |
| 386 break; | 368 break; |
| 387 } | 369 } |
| 388 Close(); | 370 Close(); |
| 389 } | 371 } |
| OLD | NEW |